问题描述:
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, try re-running with '--loglevel silly' for more details
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 **************************************************************
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 (D:workspacedscpnode_modulesnode-gyplibfind-visualstudio.js:122:47)
gyp ERR! stack at D:workspacedscpnode_modulesnode-gyplibfind-visualstudio.js:75:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (D:workspacedscpnode_modulesnode-gyplibfind-visualstudio.js:363:14)
gyp ERR! stack at D:workspacedscpnode_modulesnode-gyplibfind-visualstudio.js:71:14
gyp ERR! stack at D:workspacedscpnode_modulesnode-gyplibfind-visualstudio.js:384:16
gyp ERR! stack at D:workspacedscpnode_modulesnode-gyplibutil.js:54:7
gyp ERR! stack at D:workspacedscpnode_modulesnode-gyplibutil.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:390:5)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at maybeClose (internal/child_process.js:1088:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "D:\Program Files\nodejs\node.exe" "D:\workspace\dscp\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd D:workspacedscpnode_modulesnode-sass
gyp ERR! node -v v14.21.3
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
解决方案一:
解决方案二:
根据node版本与node-sass版本对应关系修改package.json文件node-sass版本,修改sass–loader版本
node与node-sass版本对应表
node版本 node-sass版本
node 16——6.0+
node 15——5.0+
node 14——4.14+
node13—— 4.13+,<5.0
node12—— 4.12+
node11—— 4.10+,<5.0
node10—— 4.9+,<5.0
node8——4.5.3+,<5.0
node<8—— <5.0
sass–loader与node-sass版本对应表
sass–loader版本 node-sass版本
sass-loader 4.1.1—— node-sass 4.3.0
sass-loader 7.0.3—— node-sass 4.7.2
sass-loader 7.3.1—— node-sass 4.7.2
sass-loader 7.3.1—— node-sass 4.14.1
sass-loader 10.0.1—— node-sass 6.0.1
解决方案三:
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
npm install --save
解决方案四:
npm install -g cnpm -registry=https://registry.npm.taobao.org
cnpm -v
解决方案五:
npm环境中gyp配置有问题,需要安装gyp和Windows构建工具windows–build–tools,以管理员身份运行以下命令。
npm install -g node-gyp
npm install --global --production windows-build-tools
解决方案六:
网上有说因为本地安装了python3版本的原因,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
npm config set registry https://registry.npm.taobao.org
3、安装nodejs所需的环境,执行这个命令会自动检测并帮你安装好
npm install --g --production windows-build-tools
4、关键
npm install --python=python2.7
解决方案七:
npm cache clean --force
npm install --legacy-peer-deps
npm install —legacy–peer-deps命令与其说是告诉npm要去干什么,不如说是告诉npm不要去干什么。
legacy的意思:遗产/(软件或硬件)已过时但因使用范围广而难以替代的;而npm install xxxx —legacy–peer-deps命令用于绕过peerDependency里依赖的自动安装;它告诉npm忽略项目中引入的各个依赖模块之间依赖相同但版本不同的问题,以npm v3-v6的方式去继续执行安装操作。
原文地址:https://blog.csdn.net/weixin_41386222/article/details/132085233
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_22228.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!