5

我目前正在部署在Elastic Beanstalk上的node.js应用程序上工作。它已经开始引用一个作为私有存储库在github上托管的私有模块。在本地,如果我在package.json的依赖项部分中引用它,如下所示,它工作正常。我可以运行nom安装,它下载模块和应用程序没有问题。建议如何处理node.js私有模块依赖关系?

"ModuleName": "git+https://TOKEN:[email protected]/OWNER/REPO_NAME.git" 

然而,当我尝试部署到青苗失败,出现以下错误:

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'} 

从我可以告诉通过读取看来Git是不是在默认的Linux AMI安装Beanstalk使用。我的问题是处理这个问题的最好方法是什么。目前我正在考虑以下两种选择:

  1. 要么使用安装了git的AMI,要么在启动过程中以某种方式强制安装。
  2. 创建一个构建过程,在部署到Beanstalk之前打包所有node_modules。

这两个选项是否有意义,还是应该考虑另一种选择?是否有推荐的方法来处理Elastic Beanstalk或节点生态系统中的一般情况?

+0

我会去选项(2) –

+0

我不确定Elastic Beanstalk是否没有安装git。我想这个问题是访问你的私人存储库的权限。尝试阅读本文[http://stackoverflow.com/questions/13476138/setting-up-private-github-access-with-aws-elastic-beanstalk-and-ruby-container](http://stackoverflow.com/问题/ 13476138 /设置 - 上 - 私人github上存取与-AWS-弹性青苗-和红宝石容器) – Scoup

回答