【发布时间】:2018-06-14 11:31:17
【问题描述】:
我正在尝试在 Elastic Beanstalk 上部署一个使用 express 和并发的 react 应用程序,但是我收到一个错误,它找不到 react-scripts 命令。我已经仔细检查过 react-scripts 是 json 中的一个依赖项(它是由 react 自动生成的),所以我不太确定为什么它仍然无法找到它。
下面是日志
-------------------------------------
/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
提前非常感谢! :-)
【问题讨论】:
-
我将 package.json 设置为需要节点 12+ 和 npmp 6+,但仍然出现同样的错误。我认为这是因为它需要全局安装 react-scripts,但你没有这样做就让它工作了吗?
标签: reactjs amazon-web-services express amazon-elastic-beanstalk