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

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

[复制链接]

338

主题

521

回帖

3478

积分

管理员

积分
3478
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:" @' H* P& A& Q- g1 E
```bash
" s' h/ r1 k! K) y$ Ogyp ERR! find VS" A( v* g6 z% |+ u$ {4 U
gyp ERR! find VS msvs_version not set from command line or npm config
9 D% E9 z8 }* Y" ggyp ERR! find VS running in VS Command Prompt, installation path is:
4 a3 F8 o6 z- g: B& b# ]& D" Xgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"8 T, D- o- X) }1 S" X' c& r  a
gyp ERR! find VS - will only use this version: s7 M9 Q7 \. w+ a& {7 A3 o
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer  W+ B, E9 F* u
gyp ERR! find VS looking for Visual Studio 2015
# Q# F& c9 l6 t% u; x* w& [gyp ERR! find VS - not found( D3 k5 R3 j+ ]# ?& u- a( e( A- D1 a
gyp ERR! find VS looking for Visual Studio 2013
, E5 b6 \9 S* y/ Igyp ERR! find VS - not found
3 n$ X  `! F, k0 |0 W- sgyp ERR! find VS
/ T0 e9 l% v( ~! W/ {" C+ m+ |gyp ERR! find VS **************************************************************0 \1 s* A" V4 j$ q
gyp ERR! find VS You need to install the latest version of Visual Studio
* x8 E' O$ Q8 S3 S- v, \( ]" A! ygyp ERR! find VS including the "Desktop development with C++" workload.  N, @  r: a9 Y2 W2 X: P: |' i7 a
gyp ERR! find VS For more information consult the documentation at:: {$ U! c; y1 ^2 J
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
; i9 t! w/ _: ^; x+ cgyp ERR! find VS **************************************************************
5 T% S% t4 k" |+ u+ h+ T9 S8 \( y' Jgyp ERR! find VS
  {0 s  K. a3 d# F2 _! Zgyp ERR! configure error* N( L2 a& d( `7 i! o3 E
gyp ERR! stack Error: Could not find any Visual Studio installation to use9 t4 L7 Q. s9 a  e  h  e1 _
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu2 D4 ?8 q6 ]9 i6 V. e& O) U
dio.js:121:47)- m9 g! {6 T* P7 d5 u- P
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:166 Y4 \; J- B! J* @
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
3 Q. W8 Q. c% |) v! sgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:77 N0 V9 ~$ i  y& L, W8 j9 m
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:163 a, n9 i& V( r- N! H" r; Z
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)- z2 g1 T0 Y& f$ e" u
gyp ERR! stack     at ChildProcess.emit (events.js:315:20), d1 v: a) S; j# d& X+ x* K- b9 ~
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
$ ?, D* j4 M, `1 t1 }% wgyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)/ _1 }- Q" A% ~" {" @* E- s# d
gyp ERR! System Windows_NT 10.0.15063
' A6 b: Y: [% u' T$ t

4 x, k: |3 z0 P$ U6 V5 Z, q解决办法3 Q( x4 I; ?9 L& P& o: k; T: {: X
1、卸载nodejs重新安装一遍
. L0 M& _( W& v% f/ A' ]! W$ Y$ X+ i; M# s0 d: M
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org- E- k" t# b' d% u

! s1 W1 u! I- G. q9 X  m0 ]3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools+ p0 f3 \+ H6 Y; n0 ^
————————————————- s/ x" V& E2 B. H: t. j, |
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。, g% |2 H7 V2 m9 k2 \$ \+ `
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

338

主题

521

回帖

3478

积分

管理员

积分
3478
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
% D* H) s, ~0 t- m  a; R
) W7 K: {( F! J! Q1 E& r: q由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
" [6 b3 Y5 D9 F1 t, n' a: a$ E$ v' {: ^8 j# C
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
" X& J  {. G5 k4 D————————————————% m7 ^% k* G1 i6 B
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
$ {! U6 C, H/ p, s; i9 ~9 Z原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-8 10:16 , Processed in 0.015731 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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