2016-03-14 122 views
1

愛MeteorJS到目前爲止。也許那些已經部署到EB的人可能能夠幫助我。流星在ElasticBeanstalk上的部署失敗

我能夠成功地將我的應用程序部署到EB,但是後續部署失敗。在NPM安裝階段,我得到一個錯誤信息,像這樣

gyp ERR! node -v v0.10.42 
    gyp ERR! node-gyp -v v1.0.1 
    gyp ERR! not ok 

    npm ERR! [email protected] install: `node-gyp rebuild` 
    npm ERR! Exit status 1 
    npm ERR! 
    npm ERR! Failed at the [email protected] install script. 
    npm ERR! This is most likely a problem with the bcrypt package, 
    npm ERR! not with npm itself. 
    npm ERR! Tell the author that this fails on your system: 
    npm ERR!  node-gyp rebuild 
    npm ERR! You can get their info via: 
    npm ERR!  npm owner ls bcrypt 
    npm ERR! There is likely additional logging output above. 
    npm ERR! System Linux 4.1.17-22.30.amzn1.x86_64 
    npm ERR! command "/opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm" "--production" "rebuild" 
    npm ERR! cwd /tmp/deployment/application 
    npm ERR! node -v v0.10.42 
    npm ERR! npm -v 1.4.29 
    npm ERR! code ELIFECYCLE 
    npm ERR! 
    npm ERR! Additional logging details can be found in: 
    npm ERR!  /tmp/deployment/application/npm-debug.log 
    npm ERR! not ok code 0 
    Running npm install: /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm 
    Setting npm config jobs to 1 

我現在用的是鐵CLI建立我的應用程序。我使用部署腳本看起來有點像這樣:

rm -Rf build/bundle 

iron build --server=https://my-domain.com --architecture os.linux.x86_64 

eb deploy prod 

的package.json在項目的根是這樣的:

{ 
    "name": "trail-status", 
    "version": "2.0.0", 
    "scripts": { 
    "start": "node build/bundle/main.js" 
    }, 
    "dependencies": { 
    "fibers": "1.0.1", 
    "underscore": "*", 
    "source-map-support": "*", 
    "semver": "*", 
    "bcrypt": "*" 
    } 
} 

我試圖消除建立/包/程序/服務器/ npm/npm-bcrypt/node_modules/bcrypt沒有多少運氣。也嘗試從package.json中刪除bcrypt。

+0

我不知道在後臺做什麼鐵建設,但你運行故宮在同一基礎設施+節點版本安裝? – Clarkie

回答

0

我發現解決方案是使用demeteorizer來構建我的項目。這是我的腳本,對於部署非常有效。

rm -Rf elasticbeanstalk 
rm -Rf build.zip 

cd app 

demeteorizer -a os.linux.x86_64 -o ../elasticbeanstalk 

cd .. 

zip -r build.zip elasticbeanstalk .ebextensions/ .elasticbeanstalk/ config/production 
rm -Rf elasticbeanstalk 

eb deploy production 

rm -Rf build.zip 

然後在.ebextensions/configuration.config

files: 
    "/opt/elasticbeanstalk/hooks/appdeploy/pre/51install_meteor.sh" : 
    mode: "000755" 
    user: root 
    group: root 
    encoding: plain 
    content: | 
     #!/usr/bin/env bash 
     echo !!! Setting up METEOR dependencies 
     export PATH=$PATH:/usr/local/bin 
     echo !!! Set PATH: $PATH 
     ln -s /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/node /usr/local/bin/node 
     ln -s /opt/elasticbeanstalk/node-install/node-v0.10.42-linux-x64/bin/npm /usr/local/bin/npm 
     export HOME=/home/ec2-user 
     echo !!! Creating app bundle 
     cd /tmp/deployment/application/elasticbeanstalk/bundle/programs/server 
     npm install 
     cd /usr/local/bin 
     rm npm node 
0

我已經遇到過這個問題。檢查這個discussion

該解決方案可能不只是一個。一些解決方案喲可以嘗試:

update gcc

# reinstall npm 
npm install -g npm 

# specify gcc 
CC=/opt/local/bin/gcc CXX=/opt/local/bin/gcc npm install bcrypt 

# add to package.json 
"scripts": { 
    "preinstall": "npm i -g node-gyp && node-gyp clean" 
} 

它涉及到的服務器環境。您可以登錄到您的EB實例以獲取更多信息(您可以在EC2控制檯中看到它)。