react-scripts启动错误(找不到模块'../scripts/start')-我该如何解决?

时间:2019-01-28 15:18:52

标签: javascript reactjs

我收到“错误:无法从以前使用正常的create-react-app设置的项目中找到模块“ ../scripts/start”,现在当我运行“ npm start”时出现此错误-唯一的解决方法似乎是rm -rf node_modules,然后进行npm install,但是第二天我遇到了同样的问题。有关如何解决此问题的任何想法(请参阅下面的完整错误消息)-谢谢。

>react-scripts start

module.js:549
    throw err;
    ^

Error: Cannot find module '../scripts/start'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.<anonymous> (/Users/DANTHORY/Dropbox/card-slider-challenge_TESTING/node_modules/.bin/react-scripts:28:25)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! card-slider-challenge@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the card-slider-challenge@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

package.json:

{
  "name":"card-slider-challenge",
  "version":"0.1.0",
  "private":true,
  "scripts":{
    "start":"react-scripts start",
    "build":"react-scripts build",
    "test":"jest",
    "eject":"react-scripts eject",
    "start-api":"json-server --port 3001 --watch --static none data/db.json"
  },
  "dependencies":{
    "react":"^16.3.2",
    "react-dom":"^16.3.2",
    "react-slick":"^0.23.2"
  },
  "devDependencies":{
    "jest":"^24.0.0",
    "json-server":"^0.12.2",
    "react-scripts":"^1.1.4"
  }
}

1 个答案:

答案 0 :(得分:1)

我遇到了完全相同的问题,并且执行了以下操作:

  1. 删除node_modules文件夹

  2. 运行npm install

它解决了我的问题,但是原因是什么,我不知道。