windows安装nodejieba踩坑记录

发布时间:2022-07-05 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了windows安装nodejieba踩坑记录脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

npm install 的时候总是会出现下面的错误:

gyp info find Python using Python version 3.8.6 found at "C:PRogram Filespythonpython.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version was set From command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2017
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.11.31624.102) found at:
gyp ERR! find VS "C:Program Files (x86)Microsoft Visual Studio2019BuildTools"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v142
gyp ERR! find VS - found Windows SDK: 10.0.19041.0
gyp ERR! find VS - msvs_version does not match this version
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as IT is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS - "2019"
gyp ERR! find VS - "C:Program Files (x86)Microsoft Visual Studio2019BuildTools"
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.COM/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudiofinder.fail (C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:121:47)
gyp ERR! stack     at C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:351:14)
gyp ERR! stack     at C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:70:14
gyp ERR! stack     at C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibfind-visualstudio.js:372:16
gyp ERR! stack     at C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibutil.js:54:7
gyp ERR! stack     at C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gyplibutil.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Administrator\AppData\Roaming\nvm\v16.8.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--module=D:\DEV\esop-front\node_modules\nodejieba\build\Release\nodejieba.node" "--module_name=nodejieba" "--module_path=D:\DEV\esop-front\node_modules\nodejieba\build\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93" "--python=python2.7" "--msvs_version=2017"
gyp ERR! cwd D:DEVesop-frontnode_modulesnodejieba
gyp ERR! node -v v16.8.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:Program Filesnodejsnode.exe C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js configure --module=D:DEVesop-frontnode_modulesnodejiebabuildReleasenodejieba.node --module_name=nodejieba --module_path=D:DEVesop-frontnode_modulesnodejiebabuildRelease --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93 --python=python2.7 --msvs_version=2017' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:DEVesop-frontnode_modules@mapboxnode-pre-gyplibutilcompile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\DEV\esop-front\node_modules\@mapbox\node-pre-gyp\bin\node-pre-gyp" "rebuild"
node-pre-gyp ERR! cwd D:DEVesop-frontnode_modulesnodejieba
node-pre-gyp ERR! node -v v16.8.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.5
node-pre-gyp ERR! not ok
Failed to execute 'C:Program Filesnodejsnode.exe C:UsersAdministratorAppDataRoamingnvmv16.8.0node_modulesnpmnode_modulesnode-gypbinnode-gyp.js configure --module=D:DEVesop-frontnode_modulesnodejiebabuildReleasenodejieba.node --module_name=nodejieba --module_path=D:DEVesop-frontnode_modulesnodejiebabuildRelease --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93 --python=python2.7 --msvs_version=2017' (1)

&nbsp;

网上的办法都做了个遍,都不行,包括什么清缓存、删node_modules、装windows-build-tools等等

npm install --global --production windows-build-tools

 

后来发现,首先得解决python版本(https://www.python.org/downloads/)过低问题,然后安装最新版的windows-build-tools。

最后把windows-build-tools版本和自己安装的版本对应起来。

执行最后这句:

npm config set msvs_version 2019

大功告成!注意,后面的msvs_version要和你现在安装好的版本一样(2019)。网上写的都是2017, 所以一直出错。

 

参考版本:

winows10

python3.8

"nodejieba": "^2.5.2",

 

参考链接: 

https://www.jianshu.com/p/e546464d6162

https://www.jianshu.com/p/4a45e115a626

https://stackoverflow.com/questions/65258925/how-to-fix-node-js-error-like-gyp-err-find-vs-including-the-desktop-developme

 

脚本宝典总结

以上是脚本宝典为你收集整理的windows安装nodejieba踩坑记录全部内容,希望文章能够帮你解决windows安装nodejieba踩坑记录所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。