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

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

[复制链接]

340

主题

522

回帖

3494

积分

管理员

积分
3494
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:! |! ]! }0 w8 Z" T
```bash  \3 _6 G; K! x$ Z  g: \& y
gyp ERR! find VS0 q- c& {! J+ C2 M
gyp ERR! find VS msvs_version not set from command line or npm config2 r/ J( _) g9 l, G, |
gyp ERR! find VS running in VS Command Prompt, installation path is:4 ]0 [; K% |; v; ^( S4 E
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
9 A* z: ]  Q9 d# Y& U. c" p, I8 L# t' b: agyp ERR! find VS - will only use this version
" Q- X( h4 E. p( d0 Dgyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
' |7 X! B7 v1 {gyp ERR! find VS looking for Visual Studio 2015
) @- l2 r% z' Fgyp ERR! find VS - not found
' q+ }% D# v1 B" h, v3 k  T. @gyp ERR! find VS looking for Visual Studio 2013
, u/ I3 _# R4 K5 e' Hgyp ERR! find VS - not found
  d- a/ h5 x9 _! A$ Z2 r% x+ pgyp ERR! find VS
( D: h+ M& p) U; [& `+ u9 j, S9 fgyp ERR! find VS **************************************************************4 s, H4 M# U( w% s( W7 @2 I
gyp ERR! find VS You need to install the latest version of Visual Studio
; a$ |9 b* R/ }" Xgyp ERR! find VS including the "Desktop development with C++" workload.' d- P/ l  D$ F* U
gyp ERR! find VS For more information consult the documentation at:
' F1 }6 _" N0 t* H( K% @gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
) }7 m' c6 t6 K/ k8 Wgyp ERR! find VS **************************************************************3 U6 d0 F' j7 B& K
gyp ERR! find VS
* k/ C, {" b; i! lgyp ERR! configure error
1 x9 e1 W: D8 U: [" H! Y/ \% A* a9 I, Cgyp ERR! stack Error: Could not find any Visual Studio installation to use
/ H+ `4 N8 g9 K1 ^gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
! R( l4 @' ], I/ ^dio.js:121:47)
# R" D0 A4 x% i+ J2 }gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
: p0 R! B7 Y/ Z2 K' O5 dgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16$ ^" _. a1 T4 t& h+ y1 Q# S
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7# e# n1 K  X5 @6 f. @2 Y
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:165 K/ e) W  @& V9 R2 L% R
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
- V% P2 a5 v, m; L0 r0 B9 V' Kgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
, G4 m0 @, I) m- ]gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)* A- i- c" H3 e
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)7 s2 f% e, Z% M& ~+ t* [, v
gyp ERR! System Windows_NT 10.0.15063

# P% h+ _; J6 U' ]" {' O5 y1 `# J( D% P) B7 _* W
解决办法
4 o( ?' W7 B# e3 c/ f% R% [1、卸载nodejs重新安装一遍- p3 j' c2 c/ N' V# _

' j$ A5 `: D' H3 D2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org4 |5 F7 {5 J7 p" V+ T" b
% {& O* e' a( W- d3 V
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
! q4 ]6 @1 d4 X, ^' p————————————————3 n; C+ v2 q- {* v( P4 w- M+ H  e
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。; m/ ?1 e5 [: w
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

340

主题

522

回帖

3494

积分

管理员

积分
3494
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.70 h' g5 Y1 F$ \' f9 X- L

9 U  e* Q5 j" ]+ @: q( g5 c1 o. V由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。  P9 c0 ~( L  h. ?0 Q+ ^1 ]6 J
. c1 `5 d/ q7 P  [) h" B
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
$ W) q" ^# }" I————————————————# \* a) x4 u7 ~2 t& V; |  L; C
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
5 ]+ V: x9 G: O1 I9 T+ ~( ?6 S原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 11:10 , Processed in 0.023254 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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