1

I'm posting this here as it's clearly a server configuration issue rather than a code issue.

I've got an application working on my local Windows PC, however when trying to run:

npm install bcrypt

on an AWS EC2 server (RHEL), I get the following error:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@1.0.2 install script 'node-pre-gyp install --fallback-to-build'.

There do appear to be a number of posts about bcrypt node module not working in certain environments, but none appear to be on a RHEL EC2 box, except one which told me to run the following (which didn't work):

sudo yum install nodejs npm --enablerepo=epel
sudo yum groupinstall "Development tools"
Wayneio
  • 121
  • 5

2 Answers2

1

I solved this by changing my dependency from bcrypt to bcryptjs. I'd like to know why this worked...but alas.

Wayneio
  • 121
  • 5
  • Alas, you buried your question in an answer so no one will be able give you an answer. – chicks Mar 28 '17 at 15:08
  • @chicks On the contrary. Changing the dependency 'fixed it' and therefore is *an* answer, however, I've left it open for other more verbose answers. Alternatively, people could comment on this answer. – Wayneio Mar 28 '17 at 16:51
  • Commenting for people of the future, you've replaced a C++ implementation of bcrypt with a pure JS one which might not be an answer for everyone (it's ~~30% slower). The error you got from npm's attempt to build it would have been above the error in the OP. Interestingly it also doesn't answer the question as phrased... – piemonkey Jan 30 '18 at 09:53
0

Following the answer in this question here: https://stackoverflow.com/a/60758413/4638376

I had to install the native components:

sudo yum install -y gcc-c++
Karl Taylor
  • 141
  • 3