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

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

[复制链接]

343

主题

549

回帖

3611

积分

管理员

积分
3611
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:8 d" g! O' m. J  K
```bash; g2 b0 |# \4 w# }# Z$ R/ T
gyp ERR! find VS
/ ]% l0 Y' w% x% v& _9 G7 bgyp ERR! find VS msvs_version not set from command line or npm config% V- V3 O8 s# X) j5 ]+ P- R* `& V. S
gyp ERR! find VS running in VS Command Prompt, installation path is:
5 ?7 R; Z: T$ J/ ?+ i. F  ygyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
2 ]: o: H, P# c. zgyp ERR! find VS - will only use this version4 M. u" g' O0 z- u+ M! y
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer. h" K& l, M9 y, l, Z$ E6 S! L
gyp ERR! find VS looking for Visual Studio 2015- ^% @% y* `! G8 q' K" P
gyp ERR! find VS - not found
- y3 t% n3 r# a' L$ Fgyp ERR! find VS looking for Visual Studio 2013
* T' {: g$ C: X2 |gyp ERR! find VS - not found
3 V0 R6 I" {. q% z0 w# j1 m, Tgyp ERR! find VS7 o& X$ |3 t2 X) F0 }7 J0 h$ J8 M4 c
gyp ERR! find VS **************************************************************1 I2 o/ j" T; Y8 j  O8 m' e* V
gyp ERR! find VS You need to install the latest version of Visual Studio$ e/ M( J! R0 p* M+ }* S
gyp ERR! find VS including the "Desktop development with C++" workload.
- J1 k$ Q/ B/ n# X# `5 v% M' Mgyp ERR! find VS For more information consult the documentation at:
: Q  c( u3 {8 C7 r& jgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows) V( \4 }5 N( a  E
gyp ERR! find VS **************************************************************' x3 y7 m8 x" k5 p: V. W
gyp ERR! find VS
4 T1 ?6 M% B5 P5 U+ ^1 M7 {gyp ERR! configure error5 x6 U) A0 U4 _
gyp ERR! stack Error: Could not find any Visual Studio installation to use, r" |7 c& Z+ ~( D
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
$ I" \" Q: V  v) kdio.js:121:47)
- W3 t" M0 U: m; S7 T0 d% ?7 ggyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16  i5 _3 R- T' _- f. `
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
3 F9 R0 M, v1 Q+ N8 m" Vgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7: v& R9 C  {: P8 i9 g3 f0 d; c
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:165 B$ ^% ]0 G6 V& h* f
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)8 s5 W3 y: _$ i2 T" S
gyp ERR! stack     at ChildProcess.emit (events.js:315:20); N& P3 {, P) Q" b- _6 I1 m
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16): p, \! O9 N/ q. ]- K1 F
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
6 b2 G! g/ C# P+ ?1 Ygyp ERR! System Windows_NT 10.0.15063
' R) V. E% G5 }; i2 P

% t% w1 m" g8 Y- o: f: U解决办法
" t  M+ q% d# C8 }. E/ Z1、卸载nodejs重新安装一遍, g( c. S- C( u
; }; J) s# K' E; z
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
, |6 S; i$ z8 E- C7 x) U5 G/ U* @0 ^
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
! _, H# U+ p; p5 m$ g————————————————6 E1 a6 t. D& d2 t3 X. t3 S
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
- u9 `  q4 b5 M5 ?6 S# V原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

343

主题

549

回帖

3611

积分

管理员

积分
3611
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
  V$ [3 n7 q! T# R1 @* m4 J% k7 e. g* r0 h
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。, c, w3 ~: c: F6 n

, ?  N: ^) Z; J  T" L7 Q然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
& m& P# x+ R! {( L————————————————8 k6 w/ O, G* }$ B; r
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。' ]; [# T; x) {: j9 M
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 09:52 , Processed in 0.020036 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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