Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callback called more than once while running npm install

I am having some trouble to deploy my Node.JS application to AWS using ElasticBeanStalk.

As soon as the deploy starts, while running the npm install script (default by AWS), I get the following weird error:

[email protected] node_modules/material-ui
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected]
  ├── [email protected] ([email protected])
  ├── [email protected] ([email protected], [email protected])
  ├── [email protected]
  ├── [email protected] ([email protected])
  └── [email protected] ([email protected], [email protected], [email protected], [email protected])
  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

Can anyone help me debug this problem? I've already spent too many hours trying to understand what is happening, but got no results so far.

Thanks!

like image 828
Adriano Valente Avatar asked Sep 29 '16 01:09

Adriano Valente


2 Answers

Updating npm solved it for me

npm i -g npm
like image 175
iggirex Avatar answered Sep 29 '22 02:09

iggirex


Apparently some AWS regions do have connection problems with npm (as related in this issue) and I solved it by forcing npm to download modules via http instead of https.

To do that I added a .npmrc file to the root directory of my project with the following content:
registry=http://registry.npmjs.org/

Thanks @Jason Livesay for the tips and @danilojun for helping me find the best solution!

like image 33
Adriano Valente Avatar answered Sep 29 '22 01:09

Adriano Valente