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

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

[复制链接]

322

主题

485

回帖

3164

积分

管理员

积分
3164
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:& P4 y; R" Z+ v% x9 y
```bash4 ~( V+ }7 P7 \+ Q
gyp ERR! find VS
. K6 @9 T  c$ g' W" X* zgyp ERR! find VS msvs_version not set from command line or npm config
3 Z5 b4 w1 X+ r/ Hgyp ERR! find VS running in VS Command Prompt, installation path is:
0 E& j% W" v% k+ Ngyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
$ M9 t9 |% A& g1 |3 Y! S$ B. pgyp ERR! find VS - will only use this version
# Q5 l( u7 A! H, U# d& |gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer+ N4 X) g. R- Z+ X# N7 L. F7 Y
gyp ERR! find VS looking for Visual Studio 2015
$ s0 A( {( ~+ `5 I6 p9 [4 r  F& L& rgyp ERR! find VS - not found
0 Z4 P7 b' y& p  |gyp ERR! find VS looking for Visual Studio 2013
1 b4 G& O. u4 v, Z2 ^+ `6 Vgyp ERR! find VS - not found
7 @' y# {+ J0 l; x  S) [gyp ERR! find VS; ]9 ~0 l2 r. b7 `
gyp ERR! find VS **************************************************************) x2 m! z9 l7 A  `% F
gyp ERR! find VS You need to install the latest version of Visual Studio+ C* u1 o) U9 T  N( F1 q
gyp ERR! find VS including the "Desktop development with C++" workload.9 J) l) S- Y8 B: a% h1 `
gyp ERR! find VS For more information consult the documentation at:) r* ?( q$ f. l4 [8 _/ L# ^
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows- Y$ o; R) T; i( s7 q6 }
gyp ERR! find VS **************************************************************
" l. I8 w: b0 m/ |, w  I6 X4 `gyp ERR! find VS
2 L$ W8 `! T+ m$ U" x! `5 |5 igyp ERR! configure error6 R, U7 |" U  Y  P9 u, l* W5 r
gyp ERR! stack Error: Could not find any Visual Studio installation to use5 u, @# d: P* G
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu8 w, J% V- s  {+ G% f/ b7 C
dio.js:121:47)! w: M, p1 E* A' b7 B
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
; t( u% z8 U( y$ ?gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16+ x4 i" M! u. M! d3 Y/ I! ~: y8 d5 o' V
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
8 E( a! z, r6 N. e: M! ugyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16: _1 j. z$ f0 S4 X( \$ d
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
6 s( K% D' \. }# K. y) hgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
# t8 t3 m- a/ Q9 C4 S) Egyp ERR! stack     at maybeClose (internal/child_process.js:1021:16); w" d  l! e4 S2 j0 |) W( G
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)* m6 b. N5 F- R% U' g. Q
gyp ERR! System Windows_NT 10.0.15063

9 S6 Q/ d! R- h7 g1 q  R
; A, `' f9 b3 `4 K  D解决办法
& U' Q& i4 m$ e: l$ @1、卸载nodejs重新安装一遍3 `+ f9 h, R& I, J
3 p9 r. ]& o1 [5 Y6 V( a
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org9 s- y6 e2 p$ e! r, r* ]& W

3 q. Y1 u9 ^7 x! t, t1 \1 p3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
# x, y- U, y; \! L; i  e————————————————
5 \+ e/ j9 `, {! n& H版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
0 q; j, z- E5 ?原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

322

主题

485

回帖

3164

积分

管理员

积分
3164
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
6 h# Q0 T. m) `; G% A7 [
- C" Q1 R5 A9 H7 m6 ?: v由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。+ f: E) A3 m/ o
+ \! {+ X; p4 i% ^
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
; S# A0 x, ?9 U" f————————————————
$ L6 i' ^1 Y+ U9 P版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。% x" N# Q# L( x$ f; R; ]
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|通达产控投资 ( 粤ICP备2023021749号-1|粤公网安备 44030402006137号 )

GMT+8, 2025-9-9 19:57 , Processed in 0.079268 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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