NPM Fails install of bcrypt on ElasticBeanstalk

Viewed 501

I have everything running fine locally here on OSX and I am trying to deploy this to aws elasticbeanstalk. During the deployment process I was getting an error such as the following

bcrypt@1.0.3 install /tmp/deployment/application/node_modules/bcrypt  
node-pre-gyp install --fallback-to-build   
module.js:471  
  throw err;  
  ^  
Error: Cannot find module '../'  
  at Function.Module._resolveFilename (module.js:469:15)  
  at Function.Module._load (module.js:417:25)  
  at Module.require (module.js:497:17)  
  at require (internal/module.js:20:19)  
  at Object.<anonymous>  
(/tmp/deployment/application/node_modules/.bin/node-pre-gyp:15:20)
  at Module._compile (module.js:570:32)  
  at Object.Module._extensions..js (module.js:579:10)  
  at Module.load (module.js:487:32)  
  at tryModuleLoad (module.js:446:12)  
  at Function.Module._load (module.js:438:3)  

I have read that this appears to be an issue with npm install and that I should add bcrypt directly to my package.json file for a dependency and I have done just that.

I was able to replicate the issue locally by deleting my node_modules folder and trying to run npm install without having bcrypt as a dependency. I then deleted the node_modules folder again and added bcrypt as a direct dependency and npm install worked just fine.

However I cannot seem to get this to resolve itself on elasticbeanstalk. When I ssh into the instance there is no node or npm in the path, I am not sure where they are installed to on ElasticBeanstalk. I did find that the deployment is under /tmp/deployment/application and I tried to remove the node_modules directory and deploying again however that did not solve the issue either.

1 Answers

You might wanna make sure the beanstalk instance has Python 2.x installed as BCrypt relies on this in order for it to work.

Also, beanstalk apps are installed in the following path: /var/app/current

Related