首页 > 解决方案 > 在 React.js 项目中启动本地主机服务器时出现 npm start 错误

问题描述

在 npm start 上出现此错误

'设备' 不是内部或外部命令、可运行程序或批处理文件。内部/模块/cjs/loader.js:983
抛出错误;^

错误:在 Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15) 处找不到模块“C:\Users\Home\Desktop\react-scripts\bin\react-scripts.js” .Module._load (internal/modules/cjs/loader.js:862:27) 在 Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) 在 internal/main/run_main_module.js:18 :47 {代码:'MODULE_NOT_FOUND',requireStack:[]}

在此处输入图像描述

标签: javascriptreactjsnpmnode-modulesreact-scripts

解决方案


  1. 删除 node_modules 目录

  2. 删除 package-lock.json 文件

  3. 运行 npm 安装

  4. 运行 npm start


推荐阅读