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

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

[复制链接]

341

主题

543

回帖

3579

积分

管理员

积分
3579
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:7 @# P: _* r1 H3 V7 c: U
```bash2 t* S  w6 O) a/ Z
gyp ERR! find VS
& @/ K8 i2 G7 s8 X7 g0 Egyp ERR! find VS msvs_version not set from command line or npm config
, V1 e; _4 R% s& Z% R; b3 Kgyp ERR! find VS running in VS Command Prompt, installation path is:
" J# X; G( q8 w. E# u3 B# m) h$ Tgyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017") I4 K' Q; b: s, S' W3 W- Q' d
gyp ERR! find VS - will only use this version) j) ?# K) V! T% W: k
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, g, e, S# N+ E! U6 v5 m5 ?
gyp ERR! find VS looking for Visual Studio 2015; E+ l( V/ s7 V' y
gyp ERR! find VS - not found
% c5 Q$ i- B6 I) N+ i  Kgyp ERR! find VS looking for Visual Studio 2013# x8 {3 o+ c! _- c1 F+ p$ Y
gyp ERR! find VS - not found9 T$ f. f2 H0 v1 O
gyp ERR! find VS7 m; z4 m* U7 K  Y* ]* k4 \5 O
gyp ERR! find VS **************************************************************6 T4 N# W3 w* y3 g. R3 \  W2 Z
gyp ERR! find VS You need to install the latest version of Visual Studio
" z. G7 P$ i+ a7 O' H# y; kgyp ERR! find VS including the "Desktop development with C++" workload.9 C) Z9 i/ z- m/ T- D" N
gyp ERR! find VS For more information consult the documentation at:
( F$ T  {  E% i4 |+ G0 pgyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
* v9 i: b* U$ h) t5 Zgyp ERR! find VS **************************************************************
9 C7 u7 ^. @3 M) }gyp ERR! find VS1 w5 N% j- y8 W5 V( ]5 \3 y9 m% d
gyp ERR! configure error0 c, S% q- G6 ]' H+ }5 }9 y
gyp ERR! stack Error: Could not find any Visual Studio installation to use4 f6 a) r% P3 L8 s4 T
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu* B) I: C) ?( T& {9 U0 T& X
dio.js:121:47)) [, _2 s% P  ], W/ v9 |8 i
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16% x8 }  [0 t( }2 N; e+ \! p
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
( d  l1 |/ o) }- Qgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
  |7 v$ S6 f) S! F6 E2 T& m& i2 tgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16% o/ u9 n2 n' v1 V8 S
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)9 N- t9 c5 Q6 Y
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
6 {+ K: t9 z& W9 i; W- p0 u. w5 Rgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
$ g) s2 o1 \$ u8 W7 }( L/ ?7 sgyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)* v, ?% i0 p0 X% f+ X
gyp ERR! System Windows_NT 10.0.15063
$ O2 H; V/ U! R0 {
9 \" L' R% g7 T% Q6 @) u
解决办法
! g! j7 c3 k/ z% _. z1、卸载nodejs重新安装一遍
+ _+ Q, ]; U: C
6 H0 q" X# c0 W2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org" g+ }* i/ Z- O. Z

/ Y$ ~' t' V9 k3 U) U3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
5 C4 N- l  B, [! s2 p————————————————
! t, T% `/ m. C# I' V# e7 W版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。2 N7 h( h4 s4 z$ i1 `3 w
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

341

主题

543

回帖

3579

积分

管理员

积分
3579
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
. J/ s7 J+ W% b$ Y+ ~( F" \* @" l/ _0 m7 R5 I+ r5 r' P
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
( E% J8 v3 ~) X4 I' b1 h: i7 y8 s! p, C& C  {
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!# U6 [5 k, m4 s4 V
————————————————
+ q0 f+ L! V" S) x$ H版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。' ?1 `/ z8 Q. Z* o& l
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-25 22:51 , Processed in 0.015709 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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