Node.js ElasticBeanstalk上流星部署失败

Node.js ElasticBeanstalk上流星部署失败,node.js,meteor,amazon-elastic-beanstalk,Node.js,Meteor,Amazon Elastic Beanstalk,爱流星至今。也许那些部署到EB的人能够帮助我 我能够将我的应用程序成功部署到EB,但后续部署失败。在npm安装阶段,我收到一条如下的错误消息 gyp ERR! node -v v0.10.42 gyp ERR! node-gyp -v v1.0.1 gyp ERR! not ok npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! F

爱流星至今。也许那些部署到EB的人能够帮助我

我能够将我的应用程序成功部署到EB,但后续部署失败。在npm安装阶段,我收到一条如下的错误消息

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

  npm ERR! bcrypt@0.8.5 install: `node-gyp rebuild`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the bcrypt@0.8.5 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
我正在使用iron CLI构建我的应用程序。我用来部署的脚本看起来有点像这样:

rm -Rf build/bundle

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

eb deploy prod
{
  "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": "*"
  }
}
项目根目录下的package.json如下所示:

rm -Rf build/bundle

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

eb deploy prod
{
  "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": "*"
  }
}

我尝试过删除build/bundle/programs/server/npm/npm bcrypt/node_modules/bcrypt,但运气不太好。我还尝试从package.json中删除bcrypt。

我遇到了这个问题。看看这个

解决方案可能不止一个。您可以尝试一些解决方案:


它与服务器环境有关。您可以登录到您的EB实例以获取更多信息(您可以在EC2控制台中看到它)。

我发现解决方案是使用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

我不确定iron build在后台做什么,但您是否在相同的infrastructure+节点版本上运行npm安装?如何访问与Beanstalk env相关的实际ec2实例?