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

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

[复制链接]

334

主题

517

回帖

3396

积分

管理员

积分
3396
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:" v1 H3 h( ^" g
```bash
. v( w' }4 a: M' ?+ x* ugyp ERR! find VS
; d  R( x5 W( N) P1 ogyp ERR! find VS msvs_version not set from command line or npm config
7 Z+ S1 R" y) S& d2 U/ Z" }gyp ERR! find VS running in VS Command Prompt, installation path is:
# S/ A, Y& w( {gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
) m4 C* _9 Q' ^gyp ERR! find VS - will only use this version2 m2 X+ g3 C$ r% ]) l
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
9 T" d& \8 x9 p# W- dgyp ERR! find VS looking for Visual Studio 2015
4 F* o+ z' ]) zgyp ERR! find VS - not found7 p0 X% O% d' O. H5 ~+ w. r' T: m
gyp ERR! find VS looking for Visual Studio 2013, U- X; ~" a( O2 y. @' J: L" s
gyp ERR! find VS - not found, o) G* x2 u% o6 c
gyp ERR! find VS; E: F# ]% G% |/ v+ t4 i
gyp ERR! find VS **************************************************************
9 e5 F/ \, S6 d( ]gyp ERR! find VS You need to install the latest version of Visual Studio
% M# V1 h0 p  v+ F$ B9 J; k1 I8 Egyp ERR! find VS including the "Desktop development with C++" workload.
! h3 j! Q0 ^! {4 n3 K% o% R* ugyp ERR! find VS For more information consult the documentation at:
/ _) g' R9 U$ o7 s! a' p5 Tgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows! v/ r1 Q9 e$ j$ Q5 ?6 ?
gyp ERR! find VS **************************************************************& `0 C$ p3 v5 ]/ j
gyp ERR! find VS; f/ S- M1 s9 h$ D: Y+ h  @
gyp ERR! configure error
0 {4 R, E" U- {! ^3 W1 a9 {$ Sgyp ERR! stack Error: Could not find any Visual Studio installation to use
0 b& {6 e! `5 Y0 hgyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu. b9 ^3 O# [; d* j8 T; R: r# }
dio.js:121:47)
6 r& r+ S2 ?1 e: E1 C, mgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
& \' C3 S; @# @gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
% D6 m6 L! {* Y6 d3 T& s1 ygyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:74 \5 s7 g. v8 H7 O$ }7 Y( G0 O0 l0 _
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
6 P6 }- c; c, a( _' G# sgyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
9 }2 W; @! {( i4 D) `( Cgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
& D: H8 ~  B) ^) [gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
* H, E$ `0 F% N4 h, r& J  hgyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
1 u- R; R/ d" f# x2 f$ Egyp ERR! System Windows_NT 10.0.15063
+ \( n) O2 n- S4 _9 a8 o

1 W5 M1 g" ~5 A& [( r; i& E3 O解决办法2 y5 O8 t3 K0 a* ~
1、卸载nodejs重新安装一遍0 f, R. _7 Y/ L
( _9 z1 k9 ^) i' {* H3 b
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org/ [" y- Y/ y/ T& ?# b% `

) F& S- A& U, \" s/ G3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools% A1 c/ {! E8 p$ e: a8 j
————————————————
4 H/ X: |  W; @4 h3 t版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。. u5 P" S4 P1 g, c: ^
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

334

主题

517

回帖

3396

积分

管理员

积分
3396
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
5 P5 M& f0 `( ~. G) u! p" r2 B3 A% p8 W- i& g4 X& ^- M
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。9 O8 Q0 o, \$ D0 u7 i2 Y
+ x8 g' F* J% x; L
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!0 t. q# \; G% o) Y2 L
————————————————
/ d; u8 y' x4 W4 @! S版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。' t0 S0 _5 @6 k
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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