reactjs - 反应js应用程序没有启动
问题描述
我已经使用 create-react-app 命令创建了反应应用程序,但是应用程序没有启动,异常是
`Client\web_client\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module 'E:\react-scripts\bin\react-scripts.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! web_client@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the web_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\Ravi\AppData\Roaming\npm-cache\_logs\2020-04-28T07_24_51_252Z-debug.log`
解决方案
在你的情况下,如果你有这个问题,这可能意味着 npm 没有正确安装包。你能验证 node_modules/.bin/react-scripts 存在吗?如果没有,请运行 rm -rf node_modules 和 npm install 然后再试一次。
所以你需要在克隆后在项目文件夹中运行 npm install 。之后,其他命令也将起作用。