Skip to content

Instantly share code, notes, and snippets.

@jmar777
Created February 28, 2014 22:32
Show Gist options
  • Save jmar777/9281403 to your computer and use it in GitHub Desktop.
Save jmar777/9281403 to your computer and use it in GitHub Desktop.
Debugging "Failed to run npm install. Snapshot logs for more details." on Elastic Beanstalk
First, we need to figure out what the actual error is. This is obviously frustrating given that the error message is intentionally truncating it.
1) SSH in to your node (various guides available for this if you're not already familiar with this).
2) Run this command (basically an Elastic Beanstalk wrapper command for npm install I found in a blog post [1]):
$ sudo /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2
3) Find the actual error message in the output from the npm install.
Once you know the error, it should hopefully be fairly obvious how to fix it. I've run into two different errors over the last couple days on Elastic Beanstalk:
The first was a dependency that was using the new "^X.Y.Z" version syntax, which is only supported in Node >= v0.10.26 (whereas Elastic Beanstalk only supports up to v0.10.21 as of today). The solution here was easy: hardcode a dependency version *prior* to when that dependency adopted to the new syntax.
The second issue was more annoying... it was the dreaded SELF_SIGNED_CERT_IN_CHAIN error. Not allowing self-signed certs is a new default behavior for NPM, so the proper fix here is, again, to update to a version that's newer than that Elastic Beanstalk current supports. My temporary work around was found on Stack Overflow [2]. Basically just had to create this file, and re-deploy:
<project-root>/.ebextensions/any-file-name-with-this-extension.config
```
commands:
01-command:
command: '$(find /opt/elasticbeanstalk/node-install/*/bin | grep "npm$" | head -n1) config set ca ""'
```
Please note that this is a terrible long-term solution, as it basically defeats the purpose of using HTTPS to install the dependencies. I'm simply using it on a dev server as a stop-gap measure until Elastic Beanstalk supports a recent enough version of Node / NPM. Hope that helps!
[1] http://www.bitcrunch.de/install-couchbase-node-js-amazon-elastic-beanstalk/
[2] http://stackoverflow.com/a/22097926/376789
@aviggiano
Copy link

Thank you, it helped

@roygwsidev
Copy link

Here is error:
http://i.imgur.com/A4aObS7.jpg

How can I fix this ?

@ayoola-solomon
Copy link

Thanks too 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment