node.js - 部署到弹性 beantalk 时出现 Npm 安装错误
问题描述
我想在弹性 beantalk 上部署我的 nodejs 应用程序。我正在使用标准免费层 t2.micro 实例。
但是当我尝试部署应用程序时,我收到一条错误消息
“在 /tmp/deployment/application/npm-debug.log 中找不到应用程序 npm 调试日志”。
在关于 SO 的其他问题之后,我添加了一个交换内存,因为内存不足可能会导致此问题。但我仍然遇到同样的错误。如何正确部署我的 nodejs 应用程序?
完整的错误日志如下所示:
Running npm install: /opt/elasticbeanstalk/node-install/node-v12.16.1-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2020/04/28 02:30:39 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v12.16.1-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
npm WARN deprecated babel-preset-es2015@6.24.1: Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated material-ui@0.20.2: You can now upgrade to @material-ui/core
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated fsevents@1.2.12: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> node-sass@4.12.0 install /tmp/deployment/application/node_modules/material-kit-react/node_modules/node-sass
> node scripts/install.js
Running npm install: /opt/elasticbeanstalk/node-install/node-v12.16.1-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2020/04/28 02:30:39 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v12.16.1-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
[2020-04-28T02:30:39.737Z] INFO [5113] - [Application update s-source-1@3/AppDeployStage0/AppDeployPreHook/50npm.sh] : Activity failed.
[2020-04-28T02:30:39.737Z] INFO [5113] - [Application update s-source-1@3/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2020-04-28T02:30:39.737Z] INFO [5113] - [Application update s-source-1@3/AppDeployStage0] : Activity failed.
[2020-04-28T02:30:39.738Z] INFO [5113] - [Application update s-source-1@3] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
[2020-04-28T02:31:36.601Z] INFO [5427] - [CMD-BundleLogs] : Starting activity...
[2020-04-28T02:31:36.601Z] INFO [5427] - [CMD-BundleLogs/AddonsBefore] : Starting activity...
[2020-04-28T02:31:36.601Z] INFO [5427] - [CMD-BundleLogs/AddonsBefore] : Completed activity.
[2020-04-28T02:31:36.601Z] INFO [5427] - [CMD-BundleLogs/BundleLogs] : Starting activity...
[2020-04-28T02:31:36.601Z] INFO [5427] - [CMD-BundleLogs/BundleLogs/BundleLogs] : Starting activity...
解决方案
我通过升级到 ec2.medium 解决了这个问题。似乎我的应用程序需要更多资源来构建,然后可能会发生此错误,甚至有时是不确定的。
推荐阅读
- android - 在操作栏中单击后退箭头时无法返回
- python - 对 uint16 图像的重新缩放/归一化感到困惑?
- javascript - 从源“http://localhost”访问“https://js.stripe.com/v2/”的 XMLHttpRequest 已被 CORS 策略阻止:在 opencart 中
- ansible - 稳定 | 将当前批次中的已完成主机替换为下一批中的主机
- javascript - 在 JEST-Enzyme 中编写测试用例以在构造函数中调用 promise
- postgresql - 无法在带有日期的 jsonb 字段上创建索引
- html - 为什么内部 div 不将自身定位在外部 div 内
- php - Lumen 中未定义获取 Auth guard [web]
- batch-file - 从 bat 文件运行应用程序并继续程序
- reactjs - POST 请求的身份验证错误:“未提供身份验证凭据”使用 Axios,但使用 POSTMAN 工作