找回密码
 立即注册
查看: 1454|回复: 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 | 显示全部楼层 |阅读模式
报错信息:$ @' v' K3 m1 {/ i
```bash
, o( t& Z1 \7 ~8 a+ G: ~gyp ERR! find VS" k% \5 B, [3 h9 y+ L2 M1 h/ ]
gyp ERR! find VS msvs_version not set from command line or npm config
) x% d+ ]! y# `2 F  Jgyp ERR! find VS running in VS Command Prompt, installation path is:
; X. H9 G" `3 |3 S: n1 dgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
* u4 {, K7 u0 Z5 V9 L1 H  o- c3 B* H) Tgyp ERR! find VS - will only use this version
5 M( ?) g# o- i- x1 K$ L+ agyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
' v% k9 d0 H& e! ]/ q0 x6 j' R- Ugyp ERR! find VS looking for Visual Studio 20152 X( d9 R" Y- R' _# t
gyp ERR! find VS - not found
* P# d; ^, C5 Ugyp ERR! find VS looking for Visual Studio 2013
% k& m/ R+ D# j+ z0 F- z; Z; Igyp ERR! find VS - not found
0 X3 V- C0 X* w2 n/ ngyp ERR! find VS
: F* H5 C/ f- {gyp ERR! find VS **************************************************************  u: B: \  x4 M% u
gyp ERR! find VS You need to install the latest version of Visual Studio
0 x0 l% d( q2 h- f$ f+ _1 O  ygyp ERR! find VS including the "Desktop development with C++" workload.( h9 l  y, q/ W+ h6 l
gyp ERR! find VS For more information consult the documentation at:: Y, d! I% A$ G: b! v1 Z
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
: V! W4 J$ ]  t* _% y# _. h& Sgyp ERR! find VS **************************************************************
/ O, W' D+ t, [% I0 }9 o* Ngyp ERR! find VS$ J. M: g( W1 M1 z' b
gyp ERR! configure error# R) ?/ G5 `& m8 I
gyp ERR! stack Error: Could not find any Visual Studio installation to use8 ]' B% s( r! S, \, \
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
7 a* q  ?( l2 }1 z- [5 m6 Sdio.js:121:47)3 O9 u; g, I5 j! ~# P
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
0 _$ W7 H" d* U; `, v; xgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:169 J. v3 ~8 A# t9 Q
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7$ r1 i3 S( Y( k  u7 H1 ~( Z- z
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16/ c) z5 R$ v! H+ Q" N
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
4 y" W6 `, I7 I5 ~8 ^# a( Q% A/ dgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
1 y7 s; f8 [- xgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
+ z3 _* c" a( Q3 agyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5); J; M/ `1 @% n. T* k% u
gyp ERR! System Windows_NT 10.0.15063
; O9 S6 I* e  ~  G7 o" W

. Q8 U+ O  t  Z% M解决办法' |& M- f4 T  k9 _$ V4 I
1、卸载nodejs重新安装一遍( ?6 C& W" O- A! l. a: G9 U+ Z

' L7 \; J) K* d2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org8 w3 S2 I# g7 s- ]6 P

2 P/ Q: K2 }9 P. X3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
+ q; {. G! `" R) p————————————————% B; Z8 _- E# Z) W) |
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
6 A' g- _3 L" |) |' @- U3 x' Y& k原文链接: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.75 P9 ?; ?# b! X" M( L$ q+ M  ]

8 w2 S+ H1 V5 _1 |! `由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
( q% |! n, E/ W! r. g" f+ I" y( @5 Z" H0 _: h
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!3 q9 U' c0 `; s* h
————————————————
- V5 ?5 o  }; B" r+ B: s版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
, {; E0 y2 t3 X5 I! C原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-27 19:21 , Processed in 0.013290 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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