Elastic Beanstalk npm failing
I got similar kind of error as fallows
When I looked at more details section I found this ,where it was an error in the bcrypt
library
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
- Go to
Elastic Beanstalk.
- Click on your app's environment name
- Select
Logs
on the sidebar - Click on
Request Logs
and selectLast 100 Lines
orFull Log.
- From your log, you will see why npm is failing
Time to fix it!
if it is related to
gyp WARN
,gyp WARN EACCESS
orgyp ERR
, then create a file called .npmrc in the root directory of your project. In this file, addunsafe-perm=true
. This will force npm to run node-gyp as root.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.