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

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

[复制链接]

344

主题

559

回帖

3646

积分

管理员

积分
3646
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:
* P: ]- O' L; S$ p) ~9 D
```bash
8 x! j6 I& X8 Hgyp ERR! find VS1 @6 i) {8 f6 ^
gyp ERR! find VS msvs_version not set from command line or npm config
+ F) x  M1 u+ f6 I7 L; ?0 E5 u6 Egyp ERR! find VS running in VS Command Prompt, installation path is:
( K) v$ n9 @1 igyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
, i8 {2 t+ ]3 |  T5 C8 w: k* Vgyp ERR! find VS - will only use this version5 ]  P/ d# y2 q# l1 V" M3 M0 `
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer1 o5 X6 I) j6 w3 F3 g" V: L
gyp ERR! find VS looking for Visual Studio 2015
0 D7 |4 c0 n7 S8 G  Egyp ERR! find VS - not found
4 U/ S+ e$ t% xgyp ERR! find VS looking for Visual Studio 2013
4 w1 r0 ~! G0 u) Egyp ERR! find VS - not found
  x$ V: d  z1 o# Q8 i# K' _& xgyp ERR! find VS
# W) ^/ H3 v3 H/ B5 a1 Rgyp ERR! find VS **************************************************************
- W- ?0 D: ]) |0 Q. Vgyp ERR! find VS You need to install the latest version of Visual Studio, g1 t5 Q# I2 v5 N4 }& y
gyp ERR! find VS including the "Desktop development with C++" workload.
- m( N8 O9 B+ C. xgyp ERR! find VS For more information consult the documentation at:
8 d- e* |$ a& [7 X$ T( Ngyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
% e: @( v! X+ O8 e4 hgyp ERR! find VS **************************************************************& n- G: |) d/ t/ e6 b) _
gyp ERR! find VS
% U) W. t9 k0 ]$ `5 ?! R! G: mgyp ERR! configure error
8 Y/ J4 R  t3 h' ugyp ERR! stack Error: Could not find any Visual Studio installation to use$ g, d' i& V9 l! z0 |
gyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu- s) q2 i1 P- @! k5 _5 y  O
dio.js:121:47)
& p5 u% B# Q& G) _gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
% T8 X/ W# z( e# Qgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:162 V) E4 l! p. Q* q; h" I/ A; E# y* O
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
8 d+ A3 i; a/ n% f/ ]  Pgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
; G% N4 \$ S. l' x1 _gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)( v; D' \' n9 x5 }; F# a
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
2 s: T0 {' ?. x8 ]) y' Fgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
5 J6 w+ X: A2 M; C5 X2 Z# Fgyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)% E7 v* w4 l9 ~2 r/ O
gyp ERR! System Windows_NT 10.0.15063

; Y/ T7 b1 n8 a' g5 s: X3 b
; a0 S2 P5 T9 o$ b解决办法: T. }. P/ c$ q) K
1、卸载nodejs重新安装一遍% x# l) d6 h4 t3 S1 o. l' a
& _( O$ x  ~! ^- g2 {) b' `
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
7 m9 d! T9 }; B6 y7 c$ v+ D
" u3 a$ Y" V8 f& t3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools5 C) j: @  N# F
————————————————; p  }+ c% L, H. ?  W
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
# e: |- F; |- I( ]! k# t4 x" H原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

344

主题

559

回帖

3646

积分

管理员

积分
3646
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.75 ~# ~& E7 x: g& X% b5 R7 e4 W

3 M6 D9 s/ F. @! T由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。" K0 J# D; N/ s

6 p* T4 n" y9 b然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
! h0 x9 E. W6 ~: P————————————————% W9 ]: Q5 f$ e6 O
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。( E  Q/ Y% Q9 O1 i& l3 c% Y
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-2-3 15:14 , Processed in 0.019527 second(s), 2 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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