当前位置: 首页 > 工具软件 > nodejieba > 使用案例 >

npm install 时出现一个关于nodejieba的错误node-pre-gyp WARN Tried to download(404)和一个MSBUILD : error MSB4132的错误

施慈
2023-12-01

今天在进行依赖安装的的时候,出现了一个nodejieba的报错,报错信息如下

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/yanyiwu/nodejieba/releases/download/2.4.1/nodejieba-v2.4.1-node-v72-win32-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for nodejieba@2.4.1 and node@12.18.3 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config        
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt      
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found

看了一下,下载的路径是打不开的。

这个问题我遇到了两次:
第一次: 直接下载好nodejieba的包放到node_modules的目录下面就可以了。但是不知道为什么这次没有成功。
第二次: 使用cnpm和淘宝镜像进行安装

cnpm install

然后安装nodejieba成功了。接下来报了这个:

MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 "4.0"

这个问题非常好解决,解决的办法如下

npm install --msvs_version 2015
npm config set msvs_version 2015 --global

虽然说cnpm的结构和npm有所不同,在npm install的时候尽量选用npm来进行全部依赖的安装,但是npm经常会找不到相关的依赖,此时使用cnpm就是最好的选择。

 类似资料: