ssh2: npm i ssh2 error
my run npm i ssh2
error
PS D:\project\js\autossh> npm i ssh2
> cpu-features@0.0.2 install D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features
> node-gyp rebuild
D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_mo
dules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
Configuring dependencies
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.28.29910.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: D:/project/js/autossh/node_modules/ssh2/node_modules/cpu-features/deps/cpu_features/build
Building dependencies
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.9.0+57a23d249
版权所有(C) Microsoft Corporation。保留所有权利。
Checking Build System
Building Custom Rule D:/project/js/autossh/node_modules/ssh2/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt
filesystem.c
stack_line_reader.c
string_view.c
正在生成代码...
utils.vcxproj -> D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\deps\cpu_features\build\utils.dir\Release\utils.lib
Building Custom Rule D:/project/js/autossh/node_modules/ssh2/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt
cpuinfo_x86.c
cpu_features.vcxproj -> D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\deps\cpu_features\build\Release\cpu_features.lib
Building Custom Rule D:/project/js/autossh/node_modules/ssh2/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt
list_cpu_features.c
D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\deps\cpu_features\src\utils\list_cpu_features.c(343): warning C4715: “GetCacheTypeString”: 不是所有的控件路径都返回值 [D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\deps\cpu_features\build\list_cpu_featu
res.vcxproj]
[D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\build\build_deps.vcxproj]
list_cpu_features.vcxproj -> D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\deps\cpu_features\build\Release\list_cpu_features.exe
Building Custom Rule D:/project/js/autossh/node_modules/ssh2/node_modules/cpu-features/deps/cpu_features/CMakeLists.txt
binding.cc
win_delay_load_hook.cc
正在创建库 D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\build\Release\cpufeatures.lib 和对象 D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\build\Release\cpufeatures.exp
LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library [D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\build\cpufeatures.vcxproj]
cpufeatures.vcxproj -> D:\project\js\autossh\node_modules\ssh2\node_modules\cpu-features\build\Release\\cpufeatures.node
> ssh2@1.1.0 install D:\project\js\autossh\node_modules\ssh2
> node install.js
D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" --target=v12.16.3 rebuild ) else (node "C:\Program Files\no
dejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" --target=v12.16.3 rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
binding.cc
win_delay_load_hook.cc
D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\src\binding.cc(1718,28): error C2131: 表达式的计算结果不是常数 [D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\build\sshcrypto.vcxproj]
D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\src\binding.cc(1718,28): message : 因读取超过生命周期的变量而失败 [D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\build\sshcrypto.vcxproj]
D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\src\binding.cc(1718,28): message : 请参见“this”的用法 [D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto\build\sshcrypto.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "--target=v12.16.3" "rebuild"
gyp ERR! cwd D:\project\js\autossh\node_modules\ssh2\lib\protocol\crypto
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
Failed to build optional crypto binding
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN autossh@1.0.0 No description
npm WARN autossh@1.0.0 No repository field.
+ ssh2@1.1.0
added 7 packages from 16 contributors in 10.298s
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (7 by maintainers)
I received the same
node-gyp
failures on macOS. I resolved them by addingcmake
via Homebrew.Yes. Next line is:
It’s just a bit annoying, since I’m updating packages in my project. The error pops up each time I run yarn. It’s no deal breaker. Just wanted to provide an update.