Can't resolve module (not found) in React.js

前端 未结 15 1364
太阳男子
太阳男子 2020-12-07 22:03

I can\'t believe that I\'m asking an obvious question, but I still get the error in console log.

Console says that it can\'t find the module in the directory, but I\

15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 22:18

    I faced the same issue when I created a new react app, I tried all options in https://github.com/facebook/create-react-app/issues/2534 but it didn't help. I had to change the port for the new app and then it worked. By default, apps use the port 3000.I changed the port to 8001 in package.json as follows:

      "scripts": {
        "start": "PORT=8001 react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
    

提交回复
热议问题