我试图在Elastic Beanstalk上部署一个使用express和concurrently的react应用程序但是我收到一个错误,它无法找到react-scripts命令。我已经仔细检查过,react-scripts是json中的一个依赖项(它是自动生成的反应),所以我不太清楚为什么它仍然无法找到它。
以下是日志
-------------------------------------
/var/log/nodejs/nodejs.log
-------------------------------------
[0]
[0] > project-deztructicus@0.1.0 server-live /var/app/current
[0] > node server.js
[0]
[0] Server started on port 5000
[1]
[1] > client@0.1.0 start /var/app/current/client
[1] > react-scripts start
[1]
[1] sh: react-scripts: command not found
[1] npm ERR! file sh
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno ENOENT
[1] npm ERR! syscall spawn
[1] npm ERR! client@0.1.0 start: `react-scripts start`
[1] npm ERR! spawn ENOENT
[1] npm ERR!
[1] npm ERR! Failed at the client@0.1.0 start script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1] npm WARN Local package.json exists, but node_modules missing, did you mean to install?
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! project-deztructicus@0.1.0 client: `npm start --prefix client`
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the project-deztructicus@0.1.0 client script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1] npm run client exited with code 1
非常感谢提前! : - )
答案 0 :(得分:3)
这不是create-react-app
问题,是npm问题。
请检查此链接https://github.com/npm/npm/issues/17379
答案 1 :(得分:2)
更新:这似乎只是yarn
和npm
之间的不一致
https://www.sheersense.com/?post_type=shop_order&p=75675
您可以尝试删除 node_modules
和package-lock.json
或yarn.lock
然后再次执行npm install
。
或者您可以将npm
降级为4.6.1
但没有问题
npm -g i npm@4.6.1