【发布时间】:2014-05-16 20:07:39
【问题描述】:
我目前正在开发一个部署在 Elastic Beanstalk 上的 node.js 应用程序。它已开始引用托管在 github 上的私有模块作为私有存储库。在本地,如果我在 package.json 的依赖项部分中引用它,如下所示,它可以正常工作。我可以运行 nom install,它会下载模块并且应用程序可以正常运行。
"ModuleName": "git+https://TOKEN:x-oauth-basic@github.com/OWNER/REPO_NAME.git"
但是,当我尝试部署到 Beanstalk 时,它失败并出现以下错误:
2014-04-04 00:14:09,188 [DEBUG] (1630 MainThread) [commandWrapper.py-60] [root commandWrapper main] Command result: {'status': 'FAILURE', 'results': [{'status': 'FAILURE', 'config_sets': ['Infra-EmbeddedPreBuild', 'Hook-PreAppDeploy', 'Infra-EmbeddedPostBuild'], 'returncode': 1, 'events': [{'msg': 'Failed to run npm install. Snapshot logs for more details.', 'timestamp': 1396570449, 'severity': 'ERROR'}, {'msg': 'Failed to run npm install. npm http GET https://registry.npmjs.org/express\nnpm ERR! not found: git\nnpm ERR! \nnpm ERR! Failed using git.\nnpm ERR! This is most likely not a problem with npm itself.\nnpm ERR! Please check if you have git installed and in your PATH.\n\nnpm ERR! System Linux 3.4.73-64.112.amzn1.x86_64\nnpm ERR! command "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/npm" "install"\nnpm ERR! cwd /tmp/deployment/appli', 'timestamp': 1396570449, 'severity': 'ERROR'}], 'msg': 'Error occurred during build: Command hooks failed\n'}], 'api_version': '1.0'}
据我所知,Beanstalk 使用的默认 linux AMI 上似乎没有安装 git。我的问题是处理这个问题的最佳方法是什么。目前我正在考虑以下两种选择:
- 要么使用已安装 git 的 AMI,要么在引导期间以某种方式强制安装。
- 创建一个构建过程,在部署到 Beanstalk 之前打包我的所有 node_modules。
这两个选项有意义还是我应该考虑其他选项?有没有推荐的方法来使用 Elastic Beanstalk 或在一般的节点生态系统中处理这个问题?
【问题讨论】:
-
我会选择选项(2)
-
我不确定 Elastic Beanstalk 是否没有安装 git。我想问题是访问您的私人存储库的权限。尝试阅读此http://stackoverflow.com/questions/13476138/setting-up-private-github-access-with-aws-elastic-beanstalk-and-ruby-container
标签: node.js amazon-web-services deployment amazon-elastic-beanstalk