找回密码
 立即注册
查看: 1460|回复: 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 | 显示全部楼层 |阅读模式
报错信息:
1 p/ H' m  ?! x/ e
```bash
% _- v: A6 [+ x" Zgyp ERR! find VS
) j# w& O5 y3 W% y1 E7 e. |( m; ^gyp ERR! find VS msvs_version not set from command line or npm config
) `6 z- y2 u8 U0 I  S( vgyp ERR! find VS running in VS Command Prompt, installation path is:
0 H1 m" S" A" Tgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
9 w& c, ]3 y7 X/ B5 ~6 ^gyp ERR! find VS - will only use this version8 l5 k! c8 U/ U# w
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer0 I- U* r# }0 {: v& V
gyp ERR! find VS looking for Visual Studio 2015
' r+ H9 d: R9 V$ k4 E3 |; T' P7 Fgyp ERR! find VS - not found! Q7 J1 |# j; }! N/ u
gyp ERR! find VS looking for Visual Studio 2013
  {* u1 Z7 Z, j' V8 t4 sgyp ERR! find VS - not found' ~: K' H1 |) E4 C& Y1 o: o, \& e
gyp ERR! find VS
; F9 U# p& W! S) r2 G( egyp ERR! find VS **************************************************************
/ ~/ A8 Y& i# d0 C; Q2 |gyp ERR! find VS You need to install the latest version of Visual Studio* y+ J6 A1 f% I/ \
gyp ERR! find VS including the "Desktop development with C++" workload.7 ~) u( f1 u8 q0 }
gyp ERR! find VS For more information consult the documentation at:
7 F* D/ G5 x) h! |. bgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows; c( c" r4 X% x, Z: w2 V
gyp ERR! find VS **************************************************************2 E) v% N7 V0 H8 Z
gyp ERR! find VS
# o6 A0 N7 s$ ?, egyp ERR! configure error# N! F( D8 {) A4 c. Q
gyp ERR! stack Error: Could not find any Visual Studio installation to use
( H. E, \5 Q0 }4 xgyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu: s$ F  ~( \% I' F
dio.js:121:47)
7 ]" G3 @4 |! z0 d. ~gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:165 W9 d' S. I" \  T# j: Y0 d: X
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16+ K1 ]* T8 a) ^
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:76 y9 G! P8 t& f, w5 z* W2 K0 ?8 f3 L
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
! g% D6 O3 H$ A3 Ugyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
6 O+ x- |  k. o" U5 C: Ygyp ERR! stack     at ChildProcess.emit (events.js:315:20)( I6 U. L+ W2 Y8 k/ ?# P$ i
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
" t, H" I0 _7 d* i% fgyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)+ l  m; P. h( ^  f
gyp ERR! System Windows_NT 10.0.15063

" \1 Z! s3 x7 h) j5 r) q% ]8 m7 h. D: L% q# p; ]( n
解决办法- d* w7 p8 ?! a9 D' N! E
1、卸载nodejs重新安装一遍
1 k7 |* l# j7 R, ~
9 h4 N. C. z0 J2 @, X" [+ p2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
/ O6 M6 M" t- g; O5 g& Q: E9 ]* ~( u0 e, E' u1 E
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools/ s) O+ R5 O' K
————————————————1 b6 ^! j0 q: b
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
0 U+ M9 L# h' F原文链接: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.7# [; w* I. |  u

0 }; ~' B, d& S$ a+ g( d由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。2 M% Q! a1 Z- I. ?% f5 \

4 H- |# {4 i; M$ l然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!1 N3 G" ^( Z. i0 Q* S
————————————————; s1 O" [* \& w2 y
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
# P2 ~( l( x" x& M原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-28 14:25 , Processed in 0.013237 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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