Open nephix opened 3 years ago
@nephix It should not trigger a build for you
Is there any other add-on that messes up with the node-gyp version we depend on? Can you post your dependencies?
bcrypt only supports the LTS version of node, if you are on any other patch other than LTS then use nvm to switch on to the LTS version of node
That makes sense, thank you
@surjeetsinghofficial123 @nephix bcrypt supports all versions of NodeJS since 10 including non-LTS ones
But why didn't it work for Node 15? Even tested in an empty project
It installs properly as global for you. Not sure whats the issue while compiling.
I tested on a Mac (10.15) and it installs properly. Can you provide me with npm logs? It will be located in a file like this /Users/xxx/.npm/_logs/2021-01-08T18_09_40_256Z-debug.log
Exact same issue for me on macOS 10.14.6 running node version 15.6.0. I downgraded to LTS (14.15.4 at the time of writing) and the problem went away.
Ok if others encounter this as well I think we should re-open the issue
Please provide logs. I do not have Big Sur yet, other than that I am unable to reproduce this. Even our CI is green for NodeJS 15.
It could be an issue with XCode as well
I hit this too
I'm on Big Sur and an M1 mac
Looks like there is some issue where Node is running under Rosetta. I'll get hold of a M1 Mac and investigate further
I don't know if this is related, but I managed to get into a similarly broken state. As it turns out, I think this is user error not an issue with the bcrypt
package itself. I realised that I had managed to get both the npm
and install
packages listed in my dependencies. (An easy typo which I think npm
should prevent but that's another story.) Bumping npm
from 7.5.2
to 7.5.4
(matching my currently installed version) and then running npm install
fixed the issue. (Of course, the actual fix is to remove npm
from my dependencies.) While in this case the mistake was me fat fingering a command, I wonder whether it's possible to get your package-lock.json
into a similarly "broken" state with a less obvious cause?
npm ERR! code 1 npm ERR! path /Users/hugo/Sources/dashboard/node_modules/bcrypt npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@14.15.5 | darwin | x64 npm ERR! gyp info find Python using Python version 3.9.1 found at "/usr/local/opt/python@3.9/bin/python3.9" npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/Users/hugo/.volta/tools/image/npm/7.5.4/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/hugo/Sources/dashboard/node_modules/bcrypt/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/hugo/.volta/tools/image/npm/7.5.4/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/hugo/Library/Caches/node-gyp/14.15.5/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/hugo/Library/Caches/node-gyp/14.15.5', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/hugo/.volta/tools/image/npm/7.5.4/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/hugo/Library/Caches/node-gyp/14.15.5/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/hugo/Sources/dashboard/node_modules/bcrypt', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/hugo/.volta/tools/image/npm/7.5.4/node_modules/node-gyp/lib/configure.js:351:16) npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) npm ERR! gyp ERR! System Darwin 20.3.0 npm ERR! gyp ERR! command "/Users/hugo/.volta/tools/image/node/14.15.5/bin/node" "/Users/hugo/.volta/tools/image/npm/7.5.4/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/hugo/Sources/dashboard/node_modules/bcrypt npm ERR! gyp ERR! node -v v14.15.5 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok
macOS 11.2.1 Node v14.15.5 npm 7.5.4
I agree with you @hugo. All I did was a npm i some-other-package@latest
(I was already on latest, but I was just double checking) and it changed my package-lock.json. That broke bcrypt when trying to install in Docker and showed the same error. I reverted my package-lock.json and it fixed the problem.
Regenerating package-lock helped. Here is the diff:
Same issue for me, apparently, as @gugu @hugo and @racingrebel - somehow a recent change to package-lock.json was causing this error:
npm ERR! code 1
npm ERR! path /Users/richardtreichel/nowsta/labor-market/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.3.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/local/opt/python@3.9/bin/python3.9"
npm ERR! (node:57599) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/richardtreichel/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/richardtreichel/nowsta/labor-market/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/richardtreichel/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/richardtreichel/Library/Caches/node-gyp/16.3.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/richardtreichel/Library/Caches/node-gyp/16.3.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/richardtreichel/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/richardtreichel/Library/Caches/node-gyp/16.3.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/richardtreichel/nowsta/labor-market/node_modules/bcrypt',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/richardtreichel/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/Users/richardtreichel/.nvm/versions/node/v16.3.0/bin/node" "/Users/richardtreichel/.nvm/versions/node/v16.3.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/richardtreichel/nowsta/labor-market/node_modules/bcrypt
npm ERR! gyp ERR! node -v v16.3.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/richardtreichel/.npm/_logs/2021-06-24T02_04_31_222Z-debug.log
Thanks for the suggestion to regenerate package.json, worked for me!
same issue for me
npm ERR! code 1 npm ERR! path /Users/zz/workspace/run_he/rh-console-server/node_modules/bcrypt npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.4.1 npm ERR! gyp info using node@16.14.2 | darwin | x64 npm ERR! gyp info find Python using Python version 3.9.12 found at "/usr/local/opt/python@3.9/bin/python3.9" npm ERR! gyp info spawn /usr/local/opt/python@3.9/bin/python3.9 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/zz/workspace/run_he/rh-console-server/node_modules/bcrypt/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/zz/Library/Caches/node-gyp/16.14.2/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/zz/Library/Caches/node-gyp/16.14.2', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/zz/Library/Caches/node-gyp/16.14.2/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/zz/workspace/run_he/rh-console-server/node_modules/bcrypt', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error:
gyp
failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:259:16) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 21.4.0 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/zz/workspace/run_he/rh-console-server/node_modules/bcrypt npm ERR! gyp ERR! node -v v16.14.2 npm ERR! gyp ERR! node-gyp -v v8.4.1 npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in: npm ERR! /Users/zz/.npm/_logs/2022-04-10T01_57_56_379Z-debug-0.log
The bcrypt version I use is
5.0.0
and my OS is macOS 11.1I followed a suggestion in https://github.com/nodejs/node-gyp/issues/2245 to force/global install bcrypt but it didn't work out as well. In both cases, the error message is the same