运行npm install时回叫不止一次

Adr*_*nte 5 amazon-web-services node.js npm amazon-elastic-beanstalk

我在使用ElasticBeanStalk将Node.JS应用程序部署到AWS时遇到了一些麻烦。

部署开始后,在运行npm install脚本(AWS默认)时,出现以下奇怪错误:

material-ui@0.15.4 node_modules/material-ui
  ??? simple-assign@0.1.0
  ??? react-addons-create-fragment@15.3.2
  ??? react-addons-transition-group@15.3.2
  ??? keycode@2.1.7
  ??? warning@3.0.0 (loose-envify@1.2.0)
  ??? inline-style-prefixer@2.0.4 (hyphenate-style-name@1.0.1, bowser@1.4.6)
  ??? lodash@4.16.2
  ??? react-event-listener@0.2.1 (fbjs@0.8.5)
  ??? recompose@0.20.2 (symbol-observable@0.2.4, change-emitter@0.1.2, hoist-non-react-statics@1.2.0, fbjs@0.8.5)
  npm ERR! Linux 4.1.17-22.30.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/bin/npm" "--production" "install"
  npm ERR! node v4.3.0
  npm ERR! npm  v2.14.12

  npm ERR! Callback called more than once.
  npm ERR!
  npm ERR! If you need help, you may report this error at:
  npm ERR!     <https://github.com/npm/npm/issues>

  npm ERR! Please include the following file with any support request:
  npm ERR!     /tmp/deployment/application/npm-debug.log
Run Code Online (Sandbox Code Playgroud)

谁能帮我调试这个问题?我已经花了很多时间试图了解正在发生的事情,但是到目前为止没有任何结果。

谢谢!

igg*_*rex 5

更新npm为我解决了

npm i -g npm
Run Code Online (Sandbox Code Playgroud)


Adr*_*nte 3

显然,某些 AWS 区域确实存在 npm 连接问题(如本期相关,我通过强制 npmhttp而不是通过https.

为此,我.npmrc在项目的根目录中添加了一个文件,其中包含以下内容: 感谢@Jason Livesay提供的提示和@danilojun帮助我找到最佳解决方案!
registry=http://registry.npmjs.org/

  • 我今天也遇到了这个问题,在欧盟西部地区部署。发现简单地重试在大多数情况下都有效,所以它确实是间歇性的,但使用 http 似乎给出了更具确定性的结果。 (2认同)