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

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

[复制链接]

342

主题

545

回帖

3594

积分

管理员

积分
3594
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:
8 l, ]+ x7 q# p4 w7 i4 n
```bash1 k+ Z$ @; y' R0 O% c$ }
gyp ERR! find VS# X$ b+ D1 ]: x) Q# }! M
gyp ERR! find VS msvs_version not set from command line or npm config
. {5 @% ]) Q- h( K. i  q. ggyp ERR! find VS running in VS Command Prompt, installation path is:
: L1 I- i1 e: J8 F" N  y6 Wgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
2 s1 q; z' T/ ?2 p8 h1 n8 vgyp ERR! find VS - will only use this version
6 f. Q2 Q9 F& zgyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
! ^0 z* T" S- o5 L! \2 T" Wgyp ERR! find VS looking for Visual Studio 2015, h( M) u2 {9 a* ^  ?/ j: u. }
gyp ERR! find VS - not found$ H; ]9 C$ ~/ h" y0 u% v
gyp ERR! find VS looking for Visual Studio 20138 U' Z8 b, }+ y4 f) k" d8 ^. k
gyp ERR! find VS - not found5 z/ K( |' X: d
gyp ERR! find VS' P4 A. O" m  o8 a# q) B
gyp ERR! find VS **************************************************************
  M0 c( K5 e9 g/ a8 k: ?+ Bgyp ERR! find VS You need to install the latest version of Visual Studio
1 z8 D4 J8 E2 p: s6 q, Jgyp ERR! find VS including the "Desktop development with C++" workload.9 P0 t6 ]  d4 {
gyp ERR! find VS For more information consult the documentation at:
9 t. e; \! a/ m8 E/ M4 e4 K0 z! Igyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows  ^' f: V* Y4 _" M, c3 ?( \$ x
gyp ERR! find VS **************************************************************) Y& ?$ P2 L8 {( y$ Y9 h# X
gyp ERR! find VS
6 n' x* N0 k+ H, J* Y% ^4 ~3 ]4 kgyp ERR! configure error* c7 Y2 x) {6 a
gyp ERR! stack Error: Could not find any Visual Studio installation to use
- J( W8 w* G2 L- P  agyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu  O2 C0 n& [. F; T. u
dio.js:121:47): H; i/ c  g# Z$ n7 Y
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
; Q" J9 P; c* a$ u" N* c; O. ogyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
1 k! S  R$ \! h5 qgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
6 E9 }, H. g' `  ?2 x  C6 ^gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
$ ]" M. A" h6 ]# ]- ?gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
3 C% D" M! m9 r  k; a) }/ xgyp ERR! stack     at ChildProcess.emit (events.js:315:20)  p$ q5 ]1 h' z1 B7 R7 [4 R% u
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
: n* q; e8 h8 m% ]gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)! [! @0 b* T7 Y4 A' |# |/ y
gyp ERR! System Windows_NT 10.0.15063

& @5 S( D& L0 v! E* b' G8 P3 v; q% q
解决办法( W1 M6 o# q* J2 v4 T
1、卸载nodejs重新安装一遍
0 b) o* b) L6 X( J
5 L! O6 |/ `2 I6 g3 G% y! d. h0 \, j2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
( O! [( I4 z+ y2 {" e1 A
4 e; [) v% l+ E# x3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
7 E' V) I/ J) S/ Z9 x6 D( i————————————————3 B' ?" K- o; i. y/ s+ r+ d
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
9 @0 ~) I. J2 x; O2 T& N原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

342

主题

545

回帖

3594

积分

管理员

积分
3594
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.71 G) v/ N) O0 v3 }  x" v6 b% Q7 X( U
1 P1 ~( c" [8 L; K' N
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
2 V9 `: y4 g% e) m* e' q# L$ d! R  V
; E, D9 C* b1 S8 S# N: m然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!! E: A) \) h# l
————————————————
9 D8 D" s! a- X# m: \8 T. v1 O8 C版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。3 m4 g, _, r' q  ]( \& o
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-28 01:50 , Processed in 0.013129 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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