nodejs couchbase 安装失败

nodejs couchbase install failure

我已经安装了多个软件包,如 Express、Joi、Fastify,没有任何问题。但是当我尝试使用 npm 安装 couchbase 包时,它总是失败。请在日志下方找到。

> couchbase@2.6.10 install C:\Users\JInbaraj\Documents\VSCode_Projects\Node-js\Express\node_modules\couchbase
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=12.14.1 runtime=node arch=x64 libc= platform=win32)

C:\Users\JInbaraj\Documents\VSCode_Projects\Node-js\Express\node_modules\couchbase>if not defined npm_config_node_gyp (node "D:\node-v12.14.1-win-x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\node-v12.14.1-win-x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio17\BuildTools\MSBuild.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:81:21)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "D:\node-v12.14.1-win-x64\node.exe" "D:\node-v12.14.1-win-x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\JInbaraj\Documents\VSCode_Projects\Node-js\Express\node_modules\couchbase
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
npm WARN Express@1.0.0 No description
npm WARN Express@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! couchbase@2.6.10 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the couchbase@2.6.10 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:\Users\JInbaraj\AppData\Roaming\npm-cache\_logs20-01-14T10_42_00_899Z-debug.log

我使用的是稳定的 Node JS 版本。我试图重新安装 Node JS。我尝试重新安装 Python 2.7、windows build-essentials,并在参考此 link 后尝试了 visual studio 2015 工具,但都是徒劳的。

有什么建议吗?

问题终于解决了!

Visual studio build tools 在使用 npm 命令安装时显示安装成功(我什至尝试使用多次安装npm)。后来,我使用Visual studio installer 并选择Visual studio build tools 2017 来验证安装。为了验证安装,我尝试了 Repair 选项,令我惊讶的是,它只是部分下载并从那里恢复。等待一段时间完成下载和安装。然后重新启动电脑并尝试npm i couchbase...成功了!