Node.bcrypt.js: AWS Elasticbeanstalk binaries not installable?

Created on 6 Jun 2018  路  10Comments  路  Source: kelektiv/node.bcrypt.js

Please guide as I am not able to solve the issue since last few days.

I am using Elasticbeanstalk. Why is binaries not installable?
node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp)

The following log gives permission error. Can someone guide as to how to correct this issue?

node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/bcrypt/lib' 
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/bcrypt/build'
gyp ERR! System Linux 4.14.33-51.37.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/deployment/application/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/deployment/application/node_modules/bcrypt/lib/binding" "--napi_version=1" "--node_abi_napi=napi"
gyp ERR! cwd /tmp/deployment/application/node_modules/bcrypt
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 

Most helpful comment

For anyone else who comes across this issue, this solution on stack overflow helped me to get my app deployed. Basically, you add some config to .npmrc that lets node-gyp run as root, so it has sufficient permissions to write to temp.

It's a lot easier than trying to change the permissions in an .ebextension

All 10 comments

Please give the full error log. I suspect there is some permission issue in your setup.
Binaries are available. The error summary says it's not installable.

Hi Amitosh

Sincere thanks for helping. The issue is not of bcrypt but I am still not able to solve it.

On my node 6 AWS instance your earlier version of bcrypt is working perfectly without making any permission change.

But on node 8.11 AWS instance your latest version is giving below error:

`[2018-06-07T10:52:32.379Z] INFO  [3846]  - [Application update nnnn@2/AppDeployStage0/AppDeployPreHook/50npm.sh] : Activity execution failed, because: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

  > [email protected] install /tmp/deployment/application/node_modules/bcrypt
  > node-pre-gyp install --fallback-to-build

  node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp) 
  node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/bcrypt/lib' 
  gyp ERR! configure error 
  gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/bcrypt/build'
  gyp ERR! System Linux 4.14.33-51.37.amzn1.x86_64
  gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/deployment/application/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/deployment/application/node_modules/bcrypt/lib/binding" "--napi_version=1" "--node_abi_napi=napi"
  gyp ERR! cwd /tmp/deployment/application/node_modules/bcrypt
  gyp ERR! node -v v8.11.1
  gyp ERR! node-gyp -v v3.6.2
  gyp ERR! not ok 
  node-pre-gyp ERR! build error 
  node-pre-gyp ERR! stack Error: Failed to execute '/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/deployment/application/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/deployment/application/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi' (1)
  node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/deployment/application/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
  node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
  node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
  node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
  node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  node-pre-gyp ERR! System Linux 4.14.33-51.37.amzn1.x86_64
  node-pre-gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node" "/tmp/deployment/application/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
  node-pre-gyp ERR! cwd /tmp/deployment/application/node_modules/bcrypt
  node-pre-gyp ERR! node -v v8.11.1
  node-pre-gyp ERR! node-pre-gyp -v v0.9.1
  node-pre-gyp ERR! not ok 
  Failed to execute '/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/deployment/application/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/deployment/application/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi' (1)
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the [email protected] install script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.`

node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/bcrypt/lib'

Make sure that the directory is writable. Maybe its some EBS configuration.

Yes I was trying that only but it wasn't happening. Thought since earlier bcrypt was working was it related to some config of bcrypt.

Anyway thanks for your help and sorry to post AWS issue on your repository. Was really frustrated with errors since last few days.

Hi

Just want to check whether the issue related node-gyp is occurring because of the following?

1) In 1.x version bundledDependencies wasn't mentioned
2) But in 2.x version it is.

So even though AWS Elastic Beanstalk has node-gyp module pre-installed on its system but since bcrypt uses bundledDependent node-gyp module EB doesn't have root permission for this execution.

In 1.x version since bundledDependencies was absent I never faced the issue. This is what I am assuming.

Is it possible that you do not mention bundledDependencies in your package.json in order for EB to work?

Just trying to arrive at the issue so kindly suggest since it is getting difficult to install bcrypt 2.x on EB without work around which is inconsistent.

bundledDependencies is not the cause.
It's not with us, other native deps like kerberos also have this issue, All suggest to make tmp as 777 before npm install. I think, ebs tries to compile the code as the nobody user.

For anyone else who comes across this issue, this solution on stack overflow helped me to get my app deployed. Basically, you add some config to .npmrc that lets node-gyp run as root, so it has sufficient permissions to write to temp.

It's a lot easier than trying to change the permissions in an .ebextension

Hey @tebs1200 , thanks for the info. Could you please add the relevant parts, or at least the link to this page: https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions ?

I've added a section on AWS Elastic Beanstalk to that page.

Just a note: I had this problem on a regular Ubuntu 16.04 machine, and the .npmrc thing fixed it (thanks, @tebs1200 !), so it may not just be an AWS-EB problem.

Was this page helpful?
0 / 5 - 0 ratings