从Node v5.1.0升级到v12.16.1遇到错误

时间:2020-02-25 22:02:03

标签: python node.js npm node-gyp

我正在恢复一个旧的Node项目,.nvmrc是v5.1.0。我使用nvm开始使用v12.16.1,现在运行npx inpm i时,得到以下输出:

https://gist.github.com/ruevaughn/1d465d509aa04800954d43da4ef581c7

我从该要旨中得到的主要信息是:

18 warnings and 18 errors generated.
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/cjensen/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/cjensen/.nvm/versions/node/v12.16.1/bin/node" "/Users/cjensen/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cjensen/projects/inusa/inusa-api/node_modules/bcrypt
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN eslint-config-airbnb@12.0.0 requires a peer of eslint-plugin-import@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base@8.0.0 requires a peer of eslint-plugin-import@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package loopback-testing-helpers is included as both a dev and production dependency.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.8.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/cjensen/.npm/_logs/2020-02-25T20_43_56_990Z-debug.log

这里是2020-02-25T20_43_56_990Z-debug.log


我尝试手动运行node-gyp并收到以下错误:

    ~/p/inu/inusa-api    update-node +1 !1 ?1 ▓▒░ node-gyp rebuild                                ░▒▓ ✔  30m 58s   12.16.1   14:41:49  
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@12.16.1 | darwin | x64
gyp info find Python using Python version 3.7.5 found at "/usr/local/opt/python/bin/python3.7"
gyp info spawn /usr/local/opt/python/bin/python3.7
gyp info spawn args [
gyp info spawn args   '/Users/cjensen/.nvm/versions/node/v5.1.0/lib/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/cjensen/projects/inusa/inusa-api/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/cjensen/.nvm/versions/node/v5.1.0/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/cjensen/Library/Caches/node-gyp/12.16.1/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/cjensen/Library/Caches/node-gyp/12.16.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/cjensen/.nvm/versions/node/v5.1.0/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/cjensen/Library/Caches/node-gyp/12.16.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/cjensen/projects/inusa/inusa-api',
gyp info spawn args   '-Dnode_engine=v8',
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 spawn args ]
gyp: binding.gyp not found (cwd: /Users/cjensen/projects/inusa/inusa-api) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/cjensen/.nvm/versions/node/v5.1.0/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/Users/cjensen/.nvm/versions/node/v12.16.1/bin/node" "/Users/cjensen/.nvm/versions/node/v5.1.0/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/cjensen/projects/inusa/inusa-api
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok

显然不行。因此,在我看来,node-gyp是使用节点v6.10编译的(在我决定“继续使用”之前,我确实从5升级到6)。

当我做

which -a node-gyp                                      
/Users/cjensen/.nvm/versions/node/v5.1.0/bin/node-gyp

我看到节点V5.1.0是它当前设置的路径。我在做什么错了?

1 个答案:

答案 0 :(得分:1)

您似乎正在使用旧版本的bcrypt(0.8.7)。您至少需要使用3.0.6版才能与节点12一起使用。

https://www.npmjs.com/package/bcrypt#version-compatibility