我正在尝试使用Elastic Beanstalk运行我的sailsjs服务器,但不断出现错误和部署失败:
2019-07-18 01:27:39 INFO Environment update is starting.
2019-07-18 01:28:18 INFO Deploying new version to instance(s).
2019-07-18 01:28:38 ERROR Failed to run npm install. Snapshot logs for more details.
2019-07-18 01:28:41 ERROR [Instance: i-04ad16d8b74b31e50] Command failed on instance. Return code: 1 Output: (TRUNCATED)...t/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v10.16.0-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 126.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2019-07-18 01:28:41 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2019-07-18 01:28:41 ERROR Unsuccessful command execution on instance id(s) 'i-04ad16d8b74b31e50'. Aborting the operation.
2019-07-18 01:28:42 ERROR Failed to deploy application.
我尝试从以下stackoverflow答案中获取建议: https://stackoverflow.com/a/46001517/5875610
并在unsafe-perms=true
内设置./.npmrc
,但仍然无法正常工作
我还尝试添加.ebextensions/00_change_npm_permissions.config
并添加:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_fix_node_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm/
对此,但这也不起作用。我究竟做错了什么?在此服务器上部署应用程序应该不会很烦人。