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

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

[复制链接]

338

主题

520

回帖

3458

积分

管理员

积分
3458
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:. v0 D# f! B4 l" R: v$ |& V
```bash: }$ w& G, F- H3 R1 Y0 T  d7 V
gyp ERR! find VS
% h, k+ m+ k+ _8 l% Xgyp ERR! find VS msvs_version not set from command line or npm config
5 j# i, x, M3 _+ n0 M( P$ mgyp ERR! find VS running in VS Command Prompt, installation path is:
1 c; h8 c( v" V3 g( m2 dgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
# ~6 r# x9 Q$ p# w4 n, k/ ogyp ERR! find VS - will only use this version
  G; h2 @" \) e% ygyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer- T1 u$ X6 w$ ?' f9 p- O
gyp ERR! find VS looking for Visual Studio 2015
: w' p9 N8 q. h- m7 x. Agyp ERR! find VS - not found/ w3 ?: C; k5 e# R9 W# R/ J6 f
gyp ERR! find VS looking for Visual Studio 2013  @1 n- y, @* u/ s$ L5 `" C
gyp ERR! find VS - not found
# E4 M3 w( a  ~/ s! G7 igyp ERR! find VS6 f- l/ ?3 ~6 t6 x* M
gyp ERR! find VS **************************************************************
: N# x1 W7 a/ u; y8 Rgyp ERR! find VS You need to install the latest version of Visual Studio+ k! K/ t1 r1 _5 P( m  b$ M* U
gyp ERR! find VS including the "Desktop development with C++" workload.; d' K7 G; r' @
gyp ERR! find VS For more information consult the documentation at:
- q) `) b1 X" T4 Igyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows+ ~; y; h- t- N' P" R6 c! L! t
gyp ERR! find VS **************************************************************/ n8 P2 O2 p; n4 ~' ?+ x
gyp ERR! find VS! _" b/ N, Y( d) B4 H
gyp ERR! configure error1 Z8 J3 Z- O& }9 H* e7 K. }
gyp ERR! stack Error: Could not find any Visual Studio installation to use+ j' b7 |! i5 F' ], Y/ E# T* T
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu- k8 E; V. a* w
dio.js:121:47)
# b: Z! A/ G& G+ |. ]- e) Fgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16: e. k  G" l- d1 `$ J; C
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
9 E" O6 `/ k# D. vgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7, C" q* W0 M" p' z
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16" D+ V" ^5 k, y1 N/ |, N8 a: N
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
6 ]- L8 s! |$ Tgyp ERR! stack     at ChildProcess.emit (events.js:315:20)9 `- ^7 |" W! W3 g: Q) [, P
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)4 F) t% w. b) l6 c6 ?: U
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)3 \6 o% I& G9 N! n8 u
gyp ERR! System Windows_NT 10.0.15063
3 B' w5 H* z( c, t

* |7 r8 m/ e. M" m" X解决办法4 i: Y. e5 i3 H/ [7 X. i
1、卸载nodejs重新安装一遍7 I4 {1 e$ x# l

4 n0 ^1 |, Y! Q( }. {2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
2 n$ V4 \$ v5 X6 b' |% T0 J2 e& V  |0 h
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools2 H! R% }2 E. \% y
————————————————$ z- c0 o; T+ f3 r
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。; d( j! K) c, {5 W( M
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

338

主题

520

回帖

3458

积分

管理员

积分
3458
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.79 {2 `3 ^8 m$ m5 {

0 V7 S4 e, z) }由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
9 X8 U1 r' Q2 X; K
0 f% `; m& V. L4 n- @2 q/ z- r% l然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!$ f2 t/ \) T- q+ t0 }1 N% z
————————————————0 Q; }9 G/ k' @& H
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
' e9 |3 q5 t/ P' H7 F1 M原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 15:23 , Processed in 0.016703 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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