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

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

[复制链接]

581

主题

706

回帖

4842

积分

管理员

积分
4842
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:' O2 i0 d' u" A: q+ C' k
```bash- N+ E& S2 N! }  G4 t0 r, @
gyp ERR! find VS
7 w  a0 E$ r4 Y+ `4 W" Tgyp ERR! find VS msvs_version not set from command line or npm config% v2 E; _+ W1 |  K7 _
gyp ERR! find VS running in VS Command Prompt, installation path is:
' q" N5 H* I' S5 R+ Q! ngyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"5 l7 ~, C* g- S) g# ^
gyp ERR! find VS - will only use this version7 y4 G0 S* Q+ x+ a
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer" Z* E) M8 u0 U4 ~
gyp ERR! find VS looking for Visual Studio 2015( P- i+ k# e) Y  w
gyp ERR! find VS - not found
- \$ P; J: z( K& h2 |gyp ERR! find VS looking for Visual Studio 2013
8 C1 c, H; i9 z) T3 a( ^gyp ERR! find VS - not found
! V/ t  R  S" t2 ^' K% n2 Egyp ERR! find VS
2 l! y9 m+ m6 [0 T, g. e5 Ogyp ERR! find VS **************************************************************
6 V  z! u% J- G  w0 V; N( P' _' g0 Z, U8 dgyp ERR! find VS You need to install the latest version of Visual Studio2 E9 D0 F+ h. p, a. k& H2 \. M
gyp ERR! find VS including the "Desktop development with C++" workload.
" V' J: m/ j- o; Xgyp ERR! find VS For more information consult the documentation at:
/ r$ V0 o' G4 ?! Xgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
: H; h- v( D% K3 V1 pgyp ERR! find VS **************************************************************, H9 }/ u+ z4 k9 b5 D1 y0 N
gyp ERR! find VS
& l) ?7 q! z8 V( ]gyp ERR! configure error, L0 Y8 r% H- O; j$ ]
gyp ERR! stack Error: Could not find any Visual Studio installation to use2 F' y( w, _" ]
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
& Q, I! ?3 E7 X, pdio.js:121:47). U# k6 ]. a5 |! e( F2 J3 e5 H
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
$ l. E8 [1 C1 o# R% {7 X$ r% d  ]( R, Sgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16# N0 Z4 ]9 x! _6 e" V6 o8 t
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
5 ]  j' X  B, N  N: K$ Q* q: ~gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16+ K. o4 U( e6 o' f; J
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)1 t. H1 J2 y8 [# b  H, l* a" p
gyp ERR! stack     at ChildProcess.emit (events.js:315:20); V* m' y6 T! g2 W
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16); W; \2 a& S9 h4 }
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)- J3 a% }7 M. f& S  _
gyp ERR! System Windows_NT 10.0.15063
" X; X8 S6 J: l4 e

  F8 n3 R; d) D$ @- w9 K3 q& }解决办法
7 s& a( g9 H# G: B# o! k9 W1、卸载nodejs重新安装一遍  o# y% _) H- u
! E6 _7 b) n) B
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
$ f, j* e' [! O) w1 E
$ w2 [2 W& A, P" k/ p  |3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools' X4 l& U/ P7 F
————————————————
+ U( |+ }9 @% L! E版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
+ i, b+ {7 p* A9 Q0 I+ F3 t原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
欢迎定制:13928122889
回复

使用道具 举报

581

主题

706

回帖

4842

积分

管理员

积分
4842
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7' R; K: V5 C9 l  V+ X7 z! W5 Z) Q  {% _
; Y, K6 L( [& _+ l4 |
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
$ \% V  E/ ?( t4 D* f- F
. w# Q4 ]$ j8 G) A- m4 E% V然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
! t6 G. c4 K. k+ |, O* T8 j————————————————. {- K; ?+ X5 v, e3 B# K' I
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
+ }- b4 b) J8 p) p0 W. T8 d# h. m7 q$ _原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
欢迎定制:13928122889
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-8-2 06:54 , Processed in 0.012125 second(s), 4 queries , Redis On.

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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