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

回答