找回密码
 立即注册
查看: 1423|回复: 1

npm install齐天大坑!!!gyp ERR! find VS msvs_version not set from command line

[复制链接]

340

主题

530

回帖

3542

积分

管理员

积分
3542
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:
& {+ k' r9 m  m& q7 P9 X4 i3 ~
```bash
$ H; y. i  J  S/ B0 ~gyp ERR! find VS9 f# @- L3 A: ]7 t" d9 U5 U- O2 F
gyp ERR! find VS msvs_version not set from command line or npm config
5 s6 b( Q8 W3 H$ }1 ugyp ERR! find VS running in VS Command Prompt, installation path is:0 o2 c9 \& d+ v" ^' |% z
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
* k4 g" W5 T! F* @6 j( `gyp ERR! find VS - will only use this version
/ m  Y6 ^% @3 Z7 A9 Rgyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
" E0 }, H) p  V& hgyp ERR! find VS looking for Visual Studio 2015" q! n5 t7 H" j9 a& ]
gyp ERR! find VS - not found
2 Z/ h/ {1 R0 m: ]* D# kgyp ERR! find VS looking for Visual Studio 2013
: w5 G- {4 m- fgyp ERR! find VS - not found
) W, Y9 h9 ~* \+ M" i& p+ igyp ERR! find VS
5 b' r6 K' I; n9 N9 l% n1 Hgyp ERR! find VS **************************************************************1 f! k# S, A6 y5 k) ~
gyp ERR! find VS You need to install the latest version of Visual Studio( N  X- J" I6 q, w! {6 D- ?
gyp ERR! find VS including the "Desktop development with C++" workload.. V4 A/ X/ C& ?7 A+ t$ j; x+ Y3 w
gyp ERR! find VS For more information consult the documentation at:
2 N, d; B# b& e2 Y2 _gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
0 Y# l+ M  L0 q2 r3 I4 lgyp ERR! find VS **************************************************************" ^8 k* ~9 \* O
gyp ERR! find VS
2 J* Q1 A1 k3 }gyp ERR! configure error
1 E  @/ T7 \$ K3 Ugyp ERR! stack Error: Could not find any Visual Studio installation to use- F& Z' g( U9 ~7 x* i# ]
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
; E8 I9 K4 E* j- L! Z4 M! ^+ Zdio.js:121:47)3 N; S- t6 ?( m6 d( P- Q
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
2 `+ i  a) L7 L) [! qgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
1 N& P; E- U/ B4 K3 [gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
+ X$ C1 N: A, N/ v* r$ Ggyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:169 j/ F) p* U, s
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)8 U& D* h) w" t
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)% f' i7 j; I/ h
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
+ a! l4 u% I8 T8 c1 \gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)* A; J+ \* u4 Q0 l2 ?. O5 }
gyp ERR! System Windows_NT 10.0.15063

& I% _# x4 l. `
7 I, u/ m) H9 i9 l: i/ f解决办法
/ `! y% B3 u0 G1、卸载nodejs重新安装一遍
( [4 U  W- ?5 r* l0 R1 T& y1 S% g7 [% R+ W
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
4 ^& i  f; D# k! C% G! z: D8 _; m; g
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools7 W+ c" W5 }4 R& H. u. j* |2 t( e
————————————————
* {. ~, e  d: _7 i4 q  g版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。  t! k  S) o0 ^' U! Z! `
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

340

主题

530

回帖

3542

积分

管理员

积分
3542
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
6 ]& Z2 `: H) v% w- q7 c, S+ g$ C6 I
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
& {6 t  R6 c8 o' J: q, k  `
6 Q7 q" j% L* X7 P* Y然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
  e+ Z1 r+ `) x: {# Z————————————————) b9 y& o7 a2 @  s
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
: j9 m4 w" }, z: E  E. v2 ?: K原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|通达创业无忧 ( 粤ICP备2023021749号|粤公网安备 44030402006137号 )

GMT+8, 2026-1-23 09:09 , Processed in 0.026540 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表