Elastic Beanstalk npm failing

I got similar kind of error as fallows enter image description here

When I looked at more details section I found this ,where it was an error in the bcrypt library enter image description here

So I removed that library and installed bcryptjs library and deployed it again ,then it was successful deployed. So this kind of errors may appear when there are deprecated libraries and not supportive libraries .


First, check your log by going to

  1. Go to Elastic Beanstalk.
  2. Click on your app's environment name
  3. Select Logs on the sidebar
  4. Click on Request Logs and select Last 100 Lines or Full Log.
  5. From your log, you will see why npm is failing

Time to fix it!

  1. if it is related to gyp WARN, gyp WARN EACCESS or gyp ERR, then create a file called .npmrc in the root directory of your project. In this file, add unsafe-perm=true. This will force npm to run node-gyp as root.

  2. if the error is related to a particular npm package failing to install, kindly consider an alternative to that package.

All the best !!


If anyone else comes across this, my problem was in my .gitignore I had node_modules rather than node_modules/ and the folder was getting tracked and deployed. Removing the node_modules folder from the deployment solved the issue.