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

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

[复制链接]

332

主题

513

回帖

3376

积分

管理员

积分
3376
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:/ L" J) Y% k: o
```bash* r. T. o% b, ~" X. Z) t! X& W' A: m
gyp ERR! find VS
5 j/ t, j" _9 p7 z3 ggyp ERR! find VS msvs_version not set from command line or npm config6 s! `8 ]! i* p# `% Y4 _- ^1 z
gyp ERR! find VS running in VS Command Prompt, installation path is:0 j; A' Z4 ]+ I# t$ p* R' [' N
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
9 q3 p: ], b4 R4 M  tgyp ERR! find VS - will only use this version& u1 t$ [& v: p6 A6 B2 ~
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer# E" V) k) Y7 P$ W$ W! F! @
gyp ERR! find VS looking for Visual Studio 2015
/ D; y; r& ?9 Y4 V- E2 v$ |+ pgyp ERR! find VS - not found
6 Z1 @2 e0 t3 \/ p* b/ Agyp ERR! find VS looking for Visual Studio 2013% O0 Z. {% a6 b' U
gyp ERR! find VS - not found
5 S; A4 K- P9 x" `8 W7 |% vgyp ERR! find VS1 z+ i0 y4 N( z0 ]( N2 e
gyp ERR! find VS **************************************************************
' v/ M2 g- M& n% l) J' Fgyp ERR! find VS You need to install the latest version of Visual Studio6 Y7 F9 j5 r6 [3 ?6 V7 ?; s
gyp ERR! find VS including the "Desktop development with C++" workload.6 a; Z* r" o6 a. R/ Z3 X0 a+ f
gyp ERR! find VS For more information consult the documentation at:
6 P6 `1 g) Y2 M4 mgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows  m/ q& U* e) m" w1 \: w3 d
gyp ERR! find VS **************************************************************9 ]; [1 ^: F1 m" A( g9 _8 }) g$ Z$ W
gyp ERR! find VS
5 l% k3 e$ R! c' }gyp ERR! configure error) w! E$ F, X! A. C
gyp ERR! stack Error: Could not find any Visual Studio installation to use1 k( P& E9 m4 ^: R0 o' J8 t) j4 r
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu/ t. j2 @: d! ~% n0 g  c) `% a7 x
dio.js:121:47)) ]: c$ `" T. f4 O
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
& I8 N$ w% C1 W% b  `+ T' F/ h- mgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16( N, k/ k: }8 T7 A! r
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
7 \' n$ M: a9 P% N; ~) {2 ~4 Ngyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16- W1 t; s. x* J
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)- p4 f4 ]- N/ ]8 h
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
- R! R3 Q2 w; L$ t1 Qgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
9 |" W2 X' K+ }, N6 a! C+ agyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
- L% S9 P6 E, g/ tgyp ERR! System Windows_NT 10.0.15063

9 i: s7 S; I$ p  P% w: o. D
* b* b5 q  |1 T. {* I! z, z解决办法
$ w, e2 K4 E+ G+ g( A6 t, ^1、卸载nodejs重新安装一遍
5 Y% o7 a6 |0 S& ^9 C' O9 p- V1 W- c% @$ o$ @5 M% I& G; R& D
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
$ A2 P. J& C/ K5 g3 H/ ]/ g5 {+ M
; K' P, J( U; F8 ~3 d& i7 V3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools% G3 a0 F: A5 U* U! W
————————————————7 _6 O4 ]) i; F% `; H! S
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。1 Q7 F' j* u3 l  C  y" p
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

332

主题

513

回帖

3376

积分

管理员

积分
3376
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
7 ~$ _) z2 V3 q+ x
9 i4 Q4 d8 b0 G. ?8 ~由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。( u8 n7 r9 R# d. A* S$ |
# L3 m+ O3 ^$ d+ [; ]
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
$ d6 q' F& q' [3 u% J————————————————/ N, @/ P6 F$ \! a
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。! j, @& C0 ~! Z! H' u" F
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 08:32 , Processed in 0.066998 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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