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

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

[复制链接]

430

主题

615

回帖

4155

积分

管理员

积分
4155
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:
& u. H! x6 p" D3 C1 E
```bash
7 Q6 @9 u  a2 @/ t* }5 kgyp ERR! find VS
! C5 t+ k( Q7 U( w7 ?gyp ERR! find VS msvs_version not set from command line or npm config
* a# Z4 F1 }! W; V( a+ _gyp ERR! find VS running in VS Command Prompt, installation path is:, \5 d' E  ]3 L1 w
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
* e4 ?. d$ L/ ?  z; B# {gyp ERR! find VS - will only use this version- b, I9 |, \. E- w6 z5 e
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
) L" x# G) f, d8 g3 Tgyp ERR! find VS looking for Visual Studio 2015
0 s  k- |, g. j% j9 E  ^2 k! ]gyp ERR! find VS - not found  y! l% P9 ?+ |  E8 ~
gyp ERR! find VS looking for Visual Studio 2013
( V9 @0 @) l5 V3 ]- Wgyp ERR! find VS - not found
8 T& W8 X6 \3 kgyp ERR! find VS+ b% z1 J) J6 ~# j# p' t2 e
gyp ERR! find VS **************************************************************2 ~% \# U. l, q
gyp ERR! find VS You need to install the latest version of Visual Studio
4 {: e7 @! @7 e* [! w1 `gyp ERR! find VS including the "Desktop development with C++" workload.9 C6 C  O/ i* L3 R" l
gyp ERR! find VS For more information consult the documentation at:
* G" c/ H# ~  ]6 R6 t9 Wgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows- v! b+ N& R! f
gyp ERR! find VS **************************************************************, N) B8 Y, `" n" ^7 Q# l7 A
gyp ERR! find VS
+ j) P1 V# T% n: l* K5 fgyp ERR! configure error% H9 [: r' n: p: u! @* ]' M
gyp ERR! stack Error: Could not find any Visual Studio installation to use8 b5 q: v& R6 `: H8 A" o
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
) V6 C$ ]. ~3 ]( t6 B* N/ \dio.js:121:47)3 U1 h6 [6 G- R5 N& N. {
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
" s9 l5 g5 N9 `) K  Lgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
4 y# g1 K& q- g2 }; s, N  }gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
4 [7 J% t; Z1 k/ `4 Z+ V) l% S8 [gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
' @* o& x: Z( X7 ggyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)1 j' O/ u9 U' Y
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
4 J+ f! }3 Z7 j: Y- K+ Vgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)  e3 `* s! m* T3 W' t- \$ V$ b" v
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)& Q( B# S/ O0 c/ L) [3 N( l
gyp ERR! System Windows_NT 10.0.15063
  ]8 j, e$ g7 K  N+ }8 Q. {; W

- i- b, v+ w( S( v. G: _解决办法
* {( i9 X$ }# N. N. h1、卸载nodejs重新安装一遍
+ M. ?" I  O+ [, V; G; v; R( h- r! N/ l8 k
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org# G- H) n0 P5 v0 `! P

3 ]$ x6 e) ~* f( P3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
+ J/ o0 `, i! j2 p5 Q————————————————2 y1 E- e5 q4 y, Q
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。+ b1 C# M) E" i7 L0 U8 i
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

430

主题

615

回帖

4155

积分

管理员

积分
4155
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.73 X% K8 u+ ?7 D* ?! G; M( C

6 ~( S7 d4 o, z. N1 w由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。+ Z& ?9 S2 E8 R: C% H# J0 V

/ @6 y5 S2 Z8 @然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!, v) W# }# V  {/ @* V
————————————————
& X4 k1 [/ H! B' g/ s# ~版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
: b; V( D; W/ j原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-5-9 20:23 , Processed in 0.020443 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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