VCBuild.exe在尝试安装bcrypt,node-gyp和windows-build-tools时找不到



我正在尝试将 bcrypt 添加到我的应用程序中,目前正在努力在将其添加为包时构建它。我已经尝试了几种解决方案,但在尝试安装 bcrypt 时反复获得此输出:

bcrypt@3.0.7 install C:MAICMAIC-APInode_modulesbcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.7/bcrypt_lib-v3.0.7-node-v64-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.7 and node@10.5.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it i
s installed elsewhere.  [C:MAICMAIC-APInode_modulesbcryptbuildbinding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:Program Files (x86)MSBuild14.0binmsbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:UsersUserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gyplibbuild.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "--fallback-to-build" "--module=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd C:MAICMAIC-APInode_modulesbcrypt
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Filesnodejsnode.exe C:UsersUserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=C:MAICMAIC-APInode_modulesbcryptlibbindingbcrypt_lib.node --module_name=bcrypt_lib --module_path=C:MAICMAIC-APInode_modulesbcryptlibbinding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:MAICMAIC-APInode_modulesnode-pre-gyplibutilcompile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\MAIC\MAIC-API\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:MAICMAIC-APInode_modulesbcrypt
node-pre-gyp ERR! node -v v10.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute 'C:Program Filesnodejsnode.exe C:UsersUserAppDataRoamingnpmnode_modulesnpmnode_modulesnode-gypbinnode-gyp.js build --fallback-to-build --module=C:MAICMAIC-APInode_modulesbcryptlibbindingbcrypt_lib.node --module_name=bcrypt_lib --module_path=C:MAICMAIC-APInode_modulesbcryptlibbinding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN maic-api@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@3.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@3.0.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!     C:UsersUserAppDataRoamingnpm-cache_logs2020-02-01T19_21_21_049Z-debug.log

如标题中所述,我尝试安装适用于npm的windows-build-tools以及Visual Studio 2019的构建工具(我已经安装了(。我在这里可能错过了什么?

尝试以下操作:

  • 卸载 MSBuild 工具的任何其他先前安装(如果低于此安装
  • (。
  • 卸载 Windows-build-tools

  • npm cache clean -f

使用管理员权限运行以下命令

npm install -g node-gyp
npm install --g --production windows-build-tools

然后尝试安装

npm install bcrypt

相关内容

  • 没有找到相关文章

最新更新