Bcrypt issues after Meteor 3 upgrade

I am upgrading my Meteor 2 app to Meteor 3. After the upgrade, I noticed that npm installl wasn’t possible anymore. One of the reasons is a failing gyp build in a module named nan, which seems to be a dependency of bcrypt.

I have

"bcrypt": "^3.0.8",

in my package.json, as it was recommended by Meteor at that time.

Is this package even needed anymore, and if so, which version should be used?

Even removing bcrypt from package.json altogether did not resolve the issue. (EDIT: It worked on the second attempt.)

Searching for bcrypt in my project, I noticed that the loren:login-links package (which I have patched for Meteor 3) also references bcrypt in its .versions file like this:

npm-bcrypt@0.8.6_1

Not sure if this contributes to the issue.
Here’s the relevant part of the log file:

2978 verbose stack Error: command failed
2978 verbose stack     at promiseSpawn (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:22:22)
2978 verbose stack     at spawnWithShell (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:124:10)
2978 verbose stack     at promiseSpawn (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:12:12)
2978 verbose stack     at runScriptPkg (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js:77:13)
2978 verbose stack     at runScript (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js:9:12)
2978 verbose stack     at /Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:329:17
2978 verbose stack     at run (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:67:22)
2978 verbose stack     at /Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:84:9
2978 verbose stack     at new Promise (<anonymous>)
2978 verbose stack     at callLimit (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:35:69)
2979 verbose pkgid sha3@1.2.3
2980 error code 1
2981 error path /Users/tom/.npm/_cacache/tmp/git-cloneWpBOQI/node_modules/sha3
2982 error command failed
2983 error command sh -c node-gyp rebuild
2984 error CXX(target) Release/obj.target/sha3/src/addon.o
2985 error gyp info it worked if it ends with ok
2985 error gyp info using node-gyp@10.1.0
2985 error gyp info using node@20.18.0 | darwin | arm64
2985 error gyp info find Python using Python version 3.12.4 found at "/opt/homebrew/Caskroom/miniconda/base/bin/python3"
2985 error gyp info spawn /opt/homebrew/Caskroom/miniconda/base/bin/python3
2985 error gyp info spawn args [
2985 error gyp info spawn args '/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
2985 error gyp info spawn args 'binding.gyp',
2985 error gyp info spawn args '-f',
2985 error gyp info spawn args 'make',
2985 error gyp info spawn args '-I',
2985 error gyp info spawn args '/Users/tom/.npm/_cacache/tmp/git-cloneWpBOQI/node_modules/sha3/build/config.gypi',
2985 error gyp info spawn args '-I',
2985 error gyp info spawn args '/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
2985 error gyp info spawn args '-I',
2985 error gyp info spawn args '/Users/tom/Library/Caches/node-gyp/20.18.0/include/node/common.gypi',
2985 error gyp info spawn args '-Dlibrary=shared_library',
2985 error gyp info spawn args '-Dvisibility=default',
2985 error gyp info spawn args '-Dnode_root_dir=/Users/tom/Library/Caches/node-gyp/20.18.0',
2985 error gyp info spawn args '-Dnode_gyp_dir=/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp',
2985 error gyp info spawn args '-Dnode_lib_file=/Users/tom/Library/Caches/node-gyp/20.18.0/<(target_arch)/node.lib',
2985 error gyp info spawn args '-Dmodule_root_dir=/Users/tom/.npm/_cacache/tmp/git-cloneWpBOQI/node_modules/sha3',
2985 error gyp info spawn args '-Dnode_engine=v8',
2985 error gyp info spawn args '--depth=.',
2985 error gyp info spawn args '--no-parallel',
2985 error gyp info spawn args '--generator-output',
2985 error gyp info spawn args 'build',
2985 error gyp info spawn args '-Goutput_dir=.'
2985 error gyp info spawn args ]
2985 error gyp info spawn make
2985 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
2985 error In file included from ../src/addon.cpp:4:
2985 error In file included from ../node_modules/nan/nan.h:173:
2985 error ../node_modules/nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
2985 error    55 | typedef v8::Local<v8::AccessorSignature> Sig;
2985 error       |                   ~~~~^
2985 error In file included from ../src/addon.cpp:4:
2985 error ../node_modules/nan/nan.h:2470:8: error: no matching member function for call to 'SetAccessor'
2985 error  2470 |   tpl->SetAccessor(
2985 error       |   ~~~~~^~~~~~~~~~~
2985 error /Users/tom/Library/Caches/node-gyp/20.18.0/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'imp::Sig' (aka 'int') to 'SideEffectType' for 7th argument
2985 error   816 |   void SetAccessor(
2985 error       |        ^
2985 error   817 |       Local<Name> name, AccessorNameGetterCallback getter,
2985 error   818 |       AccessorNameSetterCallback setter = nullptr,
2985 error   819 |       Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
2985 error   820 |       PropertyAttribute attribute = None,
2985 error   821 |       SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
2985 error       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2985 error /Users/tom/Library/Caches/node-gyp/20.18.0/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
2985 error   809 |   void SetAccessor(
2985 error       |        ^
2985 error   810 |       Local<String> name, AccessorGetterCallback getter,
2985 error       |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2985 error In file included from ../src/addon.cpp:4:
2985 error In file included from ../node_modules/nan/nan.h:2818:
2985 error ../node_modules/nan/nan_typedarray_contents.h:34:43: error: no member named 'GetContents' in 'v8::ArrayBuffer'
2985 error    34 |       data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
2985 error       |                                   ~~~~~~~~^
2985 error In file included from ../src/addon.cpp:9:
2985 error In file included from ../src/KeccakNISTInterface.h:17:
2985 error ../src/KeccakSponge.h:23:9: warning: 'ALIGN' macro redefined [-Wmacro-redefined]
2985 error    23 | #define ALIGN __attribute__ ((aligned(32)))
2985 error       |         ^
2985 error /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/arm/param.h:61:9: note: previous definition is here
2985 error    61 | #define ALIGN(p)        __DARWIN_ALIGN(p)
2985 error       |         ^
2985 error ../src/addon.cpp:69:36: error: no member named 'CreationContext' in 'v8::Object'
2985 error    69 |                 Local<Context> context = target->CreationContext();
2985 error       |                                          ~~~~~~~~^
2985 error ../src/addon.cpp:83:11: error: no matching member function for call to 'Set'
2985 error    83 |                 target->Set(className, f);
2985 error       |                 ~~~~~~~~^~~
2985 error /Users/tom/Library/Caches/node-gyp/20.18.0/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
2985 error   246 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
2985 error       |                                     ^   ~~~~~~~~~~~~~~~~~~~~~~~
2985 error   247 |                                         Local<Value> key, Local<Value> value);
2985 error       |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2985 error /Users/tom/Library/Caches/node-gyp/20.18.0/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
2985 error   249 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
2985 error       |                                     ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2985 error   250 |                                         Local<Value> value);
2985 error       |                                         ~~~~~~~~~~~~~~~~~~
2985 error 1 warning and 5 errors generated.
2985 error make: *** [Release/obj.target/sha3/src/addon.o] Error 1
2985 error gyp ERR! build error 
2985 error gyp ERR! stack Error: `make` failed with exit code: 2
2985 error gyp ERR! stack at ChildProcess.<anonymous> (/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
2985 error gyp ERR! System Darwin 24.2.0
2985 error gyp ERR! command "/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/bin/node" "/Users/tom/.meteor/packages/meteor-tool/.3.0.4.1skrypr.vcba++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2985 error gyp ERR! cwd /Users/tom/.npm/_cacache/tmp/git-cloneWpBOQI/node_modules/sha3
2985 error gyp ERR! node -v v20.18.0
2985 error gyp ERR! node-gyp -v v10.1.0
2985 error gyp ERR! not ok
2986 silly unfinished npm timer reify 1737629163728
2987 silly unfinished npm timer reify:build 1737629169038
2988 silly unfinished npm timer build 1737629169038
2989 silly unfinished npm timer build:deps 1737629169038
2990 silly unfinished npm timer build:run:install 1737629169046
2991 silly unfinished npm timer build:run:install:node_modules/sha3 1737629169050
2992 verbose cwd /Users/tom/.npm/_cacache/tmp/git-cloneWpBOQI
2993 verbose os Darwin 24.2.0
2994 verbose node v20.18.0
2995 verbose npm  v10.8.2
2996 verbose exit 1
2997 verbose code 1
2998 error A complete log of this run can be found in: /Users/tom/.npm/_logs/2025-01-23T10_46_03_596Z-debug-0.log

Just noticed that the issue even occurs when I do a fresh npm i in my Meteor 2 version. Maybe it’s related to my upgrade to a M3 Mac a year ago? I think I never made a fresh install since. If I remove bcrypt, it works on Meteor 2 again.

This issue does not occur on my AWS Ubuntu deployments via mup. They are working fine.

Yet now I am seeing this when trying to run the Meteor 2 app:

Error: Broken symbolic link encountered at /Users/tom/dev/marble/webapp/node_modules/.bin/detect-libc
    at isWithinProdPackage (/tools/isobuild/bundler.js:495:19)
    at /tools/isobuild/builder.js:724:15
    at Array.forEach (<anonymous>)
    at walk (/tools/isobuild/builder.js:656:34)
    at /tools/isobuild/builder.js:734:11
    at Array.forEach (<anonymous>)
    at walk (/tools/isobuild/builder.js:656:34)
    at Builder._copyDirectory (/tools/isobuild/builder.js:788:5)
    at Builder.copyNodeModulesDirectory (/tools/isobuild/builder.js:550:17)
    at /tools/isobuild/bundler.js:2569:17
    at Function.each (/Users/tom/.meteor/packages/meteor-tool/.2.16.0.vsqqeh.45bko++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/underscore/underscore-node-f-pre.js:1321:7)
    at JsImage.write (/tools/isobuild/bundler.js:2526:7)
    at ServerTarget.write (/tools/isobuild/bundler.js:2781:13)
    at /tools/isobuild/bundler.js:2949:30
    at /tools/isobuild/bundler.js:3088:11
    at Array.forEach (<anonymous>)
    at /tools/isobuild/bundler.js:3083:26
    at /tools/isobuild/bundler.js:3456:22
    at Object.capture (/tools/utils/buildmessage.js:283:5)
    at bundle (/tools/isobuild/bundler.js:3262:31)
    at /tools/isobuild/bundler.js:3205:32
    at Slot.withValue (/Users/tom/.meteor/packages/meteor-tool/.2.16.0.vsqqeh.45bko++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at Object.withCache (/Users/tom/.meteor/packages/meteor-tool/.2.16.0.vsqqeh.45bko++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/fs/tools/fs/files.ts:1543:39)
    at Object.bundle (/tools/isobuild/bundler.js:3205:16)
    at /tools/runners/run-app.js:579:24
    at Function.run (/Users/tom/.meteor/packages/meteor-tool/.2.16.0.vsqqeh.45bko++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/tool-env/tools/tool-env/profile.ts:289:14)
    at bundleApp (/tools/runners/run-app.js:578:34)
    at AppRunner._runOnce (/tools/runners/run-app.js:625:35)
    at AppRunner._fiber (/tools/runners/run-app.js:947:28)
    at /tools/runners/run-app.js:408:12
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

bcrypt is at 5.1.1. I don’t have any problems in any of my projects.

Ok, thanks. Maybe I have to bump it from 3.0 then? Is bcrypt really needed for Meteor 3? I didn’t get any warning anymore after I removed it.

It would be worth mentioning this in the upgrade guide.