首页 > 解决方案 > npm start 抛出错误:internal/modules/cjs/loader.js:1032 throw err

问题描述

npm start, npm test,npm run并且npm build都抛出这个错误,当我创建了一个带有节点的后端时,我尝试使用 nodemon 并添加脚本启动 nodemon index.js。然后我运行命令npm start这也会引发错误。 https://i.stack.imgur.com/YVk92.png

PS F:\all_js_works\Net Ninja Graphql with Node & React\client> npm start

> client@0.1.0 start F:\all_js_works\Net Ninja Graphql with Node & React\client
> react-scripts start

'React\client\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:1032
  throw err;
  ^

Error: Cannot find module 'F:\all_js_works\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
    at Function.Module._load (internal/modules/cjs/loader.js:898:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-06-18T12_02_03_487Z-debug.log

标签: npm

解决方案


删除您的node modules目录,package-lock.json然后重试

rm -rf node_modules && rm package-lock.json && npm install

推荐阅读