Skip to content

Install bcrypt fails with yarn 0.24 (node-pre-gyp) #3406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cebor opened this issue May 14, 2017 · 17 comments
Closed

Install bcrypt fails with yarn 0.24 (node-pre-gyp) #3406

cebor opened this issue May 14, 2017 · 17 comments
Labels

Comments

@cebor
Copy link

cebor commented May 14, 2017

Installing bcrypt with yarn fails, reproducible with the following steps:

mkdir test && cd $_
yarn init
yarn add bcrypt

Error:

yarn add v0.24.4
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[1/1] ⠈ bcrypt: node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz
[-/1] ⠈ waiting...
[-/1] ⠈ waiting...
[-/1] ⠈ waiting...
error /Users/felix/asd/node_modules/bcrypt: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-pre-gyp install --fallback-to-build
Directory: /Users/felix/asd/node_modules/bcrypt
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp info check checked for "/Users/felix/asd/node_modules/bcrypt/lib/binding/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v51-darwin-x64.tar.gz
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/felix/asd/node_modules/node-pre-gyp/lib/util/compile.js:77:29)
node-pre-gyp ERR! stack     at emitOne (events.js:96:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:213:12)
node-pre-gyp ERR! stack     at onErrorNT (internal/child_process.js:367:16)
node-pre-gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:80:11)
node-pre-gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:104:9)
node-pre-gyp ERR! System Darwin 16.5.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/7.10.0/bin/node" "/Users/felix/asd/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/felix/asd/node_modules/bcrypt
node-pre-gyp ERR! node -v v7.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp clean' (Error: spawn node-gyp ENOENT)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Installing bcrypt with npm or yarn 0.23.4 works fine.

macOS Sierra 10.12.4
node v7.10.0
yarn 0.24.4

@rally25rs
Copy link
Contributor

bcrypt installs OK for me on:

OSX Sierra
Node 6.3.0 and 7.7.1
Yarn 0.23.4 and 0.24.4

node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp info check checked for "/Users/jvalore/Projects/yarn-test/node_modules/bcrypt/lib/binding/bcrypt_lib.node" (not found)
node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-darwin-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/Users/jvalore/.nvm/versions/node/v6.3.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jvalore/Projects/yarn-test/node_modules/bcrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jvalore/.nvm/versions/node/v6.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/jvalore/.node-gyp/6.3.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/jvalore/.node-gyp/6.3.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/jvalore/.nvm/versions/node/v6.3.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/jvalore/Projects/yarn-test/node_modules/bcrypt',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/bcrypt_lib.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
✨  Done in 3.85s.

I thought maybe this was a regression from 0.23 to 0.24, but I tried it before and after upgrading and it worked for me with both Yarn versions.

From some searches, it seems like node-gyp loves to fail for lots of people for lots of different reasons. Seems like every open source project out there that has anything that needs node-gyp in its dependency tree eventually end up with issues like this one.

Can anyone else reproduce and debug?

@cebor
Copy link
Author

cebor commented May 15, 2017

@rally25rs
I think it has something to do with that I have only the commandlinetools installed and not xcode.

But with 0.23 all works fine for me.

@cebor cebor changed the title Install bcrypt fails with yarn Install bcrypt fails with yarn (node-gyp) May 15, 2017
@Daniel15
Copy link
Member

Daniel15 commented May 15, 2017

This may be an issue with node-pre-gyp specifically. Regular node-gyp seems to work fine.

@lyhoanglong
Copy link

I have the same problem. I rollback yarn to version 0.22.0 and its works.

@Daniel15
Copy link
Member

There's a discussion about this going on in #3240

@cebor cebor changed the title Install bcrypt fails with yarn (node-gyp) Install bcrypt fails (node-pre-gyp) May 16, 2017
@cebor cebor changed the title Install bcrypt fails (node-pre-gyp) Install bcrypt fails with yarn 0.24 (node-pre-gyp) May 16, 2017
@cebor
Copy link
Author

cebor commented May 17, 2017

Meanwhile the following is a workaround to get it working:

yarn global add node-gyp

@Daniel15
Copy link
Member

Yeah, that's a reasonable fix @cebor. Either that or add npm's node-gyp directory to your PATH, if you have npm installed.

@cebor
Copy link
Author

cebor commented Jul 2, 2017

Issue is still in 0.27.5.

@cebor
Copy link
Author

cebor commented Sep 28, 2017

Fixed since v1

@cebor cebor closed this as completed Sep 28, 2017
@cebor cebor reopened this Dec 14, 2017
@cebor
Copy link
Author

cebor commented Dec 14, 2017

Issue is back since node 9.

@Daniel15
Copy link
Member

@cebor If you've upgraded Node.js, you might need to reinstall node-gyp. yarn global add node-gyp.

@rally25rs
Copy link
Contributor

We also don't officially support Node 9 yet.

@cebor
Copy link
Author

cebor commented Dec 14, 2017

@Daniel15 works thank you!

@cebor cebor closed this as completed Dec 14, 2017
@perrosnk
Copy link

perrosnk commented Dec 25, 2017

@cebor are you experiencing an increase in build time at Building fresh packages... when using yarn and node-gyp compared to node-pre-gyp?

@tomevans18
Copy link

@Daniel15 thank you!! Been having issues for days when trying to add yarn add bcryptand using yarn global add node-gyp has fixed the issue.

OSX High Sierra 10.13.1
Node 9.3.0
Yarn 1.3.2

@Mukesh-nitp
Copy link

try to use latest 'node-pre-gyp' version
and do not provide bcrypt version at the time of installation.
this way I fixed my issue.

@willianfalbo
Copy link

willianfalbo commented Jan 6, 2020

I managed to solve this by running the command:
sudo apt-get install -y build-essential python and then yarn add bcrypt.

You can find the instructions here:
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions
https://github.com/kelektiv/node.bcrypt.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants