kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.44k stars 512 forks source link

Install fails when any parent directory name contains a space (Big Sur under M1) #867

Closed ostracod closed 1 year ago

ostracod commented 3 years ago

Starting conditions:

To reproduce:

mkdir "blah blah"
cd "blah blah"
mkdir wow
cd wow
npm init -y
npm install bcrypt

Resulting error:

  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
clang: error: no such file or directory: 'blah/wow/node_modules/node-addon-api'
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/homebrew/Cellar/node@14/14.15.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

Counter-example (builds just fine):

mkdir blah_blah
cd blah_blah
mkdir wow
cd wow
npm init -y
npm install bcrypt

Seems like some path is not properly quoted during the build process.

recrsn commented 3 years ago

Yes I'm aware of it. It's some underlying package used by mkdirp that has this issue.

sam3d commented 2 years ago

Oh my goodness thank you so much for this. I spent several hours trying to identify a bug in node-gyp on node v16 only to find it's because there's a space in a parent directory! You're a star! 🎉

recrsn commented 1 year ago

Tracking it here: https://github.com/kelektiv/node.bcrypt.js/issues/961