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

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

[复制链接]

334

主题

517

回帖

3398

积分

管理员

积分
3398
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:9 U) k7 X6 Q( K
```bash
- b9 @* K, O( ^+ b) k0 c2 F; m1 mgyp ERR! find VS
+ s( u/ i5 ~/ Q$ P( `/ q0 i/ fgyp ERR! find VS msvs_version not set from command line or npm config! H; ?  H1 v% `/ N) |
gyp ERR! find VS running in VS Command Prompt, installation path is:( u: d! F. x" _
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017". Q) ]% u) Y. U- h& @
gyp ERR! find VS - will only use this version
' p' S1 X( Q; L! r, o! ygyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
* y+ E9 g+ ^% k: U: E! B4 Y$ vgyp ERR! find VS looking for Visual Studio 2015
# Z8 c. l5 {# S  Jgyp ERR! find VS - not found5 j* M/ |, z, z/ L+ B& i3 f
gyp ERR! find VS looking for Visual Studio 2013
6 w+ c8 C; m, j- B% m, Hgyp ERR! find VS - not found1 H& Z' q* q  L* t
gyp ERR! find VS7 {6 u  y4 \8 \2 G  a9 G
gyp ERR! find VS **************************************************************
3 X- e+ e. h' N& E' I) zgyp ERR! find VS You need to install the latest version of Visual Studio
: J* r# k& g/ xgyp ERR! find VS including the "Desktop development with C++" workload.& u' C8 U) d0 U- _
gyp ERR! find VS For more information consult the documentation at:
9 D0 m/ \+ P" c. P, K$ ogyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
  o# P' D9 s# f: @9 [gyp ERR! find VS **************************************************************
1 L+ k! ^6 L: q  Xgyp ERR! find VS
0 n8 q* u9 i9 p5 @' c- Zgyp ERR! configure error* P% \, g4 t% L; P3 I% y4 M6 b5 K5 |
gyp ERR! stack Error: Could not find any Visual Studio installation to use: P5 I1 c* F; g# z9 h) n- E5 q1 Z
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
- V- p1 Y/ J  z2 }& R, ~" rdio.js:121:47)
3 g" F# e  B& ~& ^$ k* `gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:161 N2 k1 L* z( H) J4 v
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:168 C& x+ M; h/ D
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7$ @" F/ k! K, H
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
6 A& m# w; \. D0 Mgyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
. N! w1 K6 ]+ r3 x" jgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
$ I% r1 O( c1 u0 O# E' I' Rgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
1 B5 y  F: E  @/ @gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5): X( c5 F( l) E7 q
gyp ERR! System Windows_NT 10.0.15063
$ b9 x$ b! w$ p  i% w1 o4 y' t
4 h# {- G+ o/ ~0 K) B# X, W
解决办法! u. k, t: Q0 P; @( a6 s& U- o. |
1、卸载nodejs重新安装一遍
6 J* [/ ]2 j1 N3 Y1 a( N
% a$ x+ W4 Y# ~2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
; D7 r6 X0 E8 b+ a8 f6 l, f
' ^/ a' D" y  `) h, W; o) c3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
5 p% B% V' N  _& j: Y# K) \8 b————————————————
0 s' H2 n2 E6 \/ {6 V! z, Z' Q3 {版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
1 M  q& |8 E) G原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

334

主题

517

回帖

3398

积分

管理员

积分
3398
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
7 f, O. C3 N0 E7 C7 N. G
+ E! h+ v2 E2 G由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。8 z- u  T# x: A' D5 s( a6 u
4 U/ G5 e! J- M3 `
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!8 i7 U; ~7 k5 C3 F" V
————————————————
% H. x, I# Q3 Z3 L版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。) ~* Q9 F9 o9 I3 z9 R9 D! K
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 09:59 , Processed in 0.077346 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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