npm - 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
解决方案
删除您的node modules
目录,package-lock.json
然后重试
rm -rf node_modules && rm package-lock.json && npm install
推荐阅读
- c - C 语言使用链表创建实例和数据类型
- visual-studio - 为什么 Visual Studio 2019 不会运行我的单元测试?
- ios - 从核心数据加载数据以显示在集合视图上
- sql-server - 如何使用 SSIS 2019 读取平面文件并将其加载到 2 个不同的 SQL 表(不同的表结构)中
- javascript - Bootstrap 下拉按钮更改位置
- java - Eclipse 中的双精度浮点数与双精度浮点数
- c - 在我的程序显示其输出后,如何避免此回溯错误?
- c++ - 使用 for 循环填充向量列表
- javascript - 编写 Firefox 插件时如何覆盖 Web API 中的函数?
- jquery - 悬停时如何水平展开框以显示隐藏的文本