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

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

[复制链接]

334

主题

517

回帖

3394

积分

管理员

积分
3394
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:1 `: J* j0 E1 e) p' y
```bash
8 S, }. q! b# F& ]gyp ERR! find VS1 W5 F' n5 {0 v2 R2 h
gyp ERR! find VS msvs_version not set from command line or npm config! z; a7 ^; `+ z
gyp ERR! find VS running in VS Command Prompt, installation path is:
. m; W+ x; c& b4 m, @7 Q# x( i1 Egyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017") a( u& D3 u) c1 Q
gyp ERR! find VS - will only use this version
; [5 X( F* |/ W# h8 S8 fgyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
5 O: c4 M$ C; Hgyp ERR! find VS looking for Visual Studio 2015: k" u6 |0 n' p$ x* D* [
gyp ERR! find VS - not found. i7 z7 d2 W; t" c
gyp ERR! find VS looking for Visual Studio 20139 q( w+ P: Z7 }$ @5 Q% G
gyp ERR! find VS - not found7 K; O9 ~2 J( z, C
gyp ERR! find VS' G0 L- S) U- R5 i9 n$ N1 V' e2 Q
gyp ERR! find VS **************************************************************# s" t, u, g7 ?8 G
gyp ERR! find VS You need to install the latest version of Visual Studio
1 d9 |! M, ?+ ^5 Ogyp ERR! find VS including the "Desktop development with C++" workload.: p1 b4 J1 s' s: ^6 d+ ~
gyp ERR! find VS For more information consult the documentation at:6 D8 r* K0 ^$ o& G6 R" e
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows4 W, @' Q' u. v7 j1 m$ D2 r4 S$ [
gyp ERR! find VS **************************************************************
, C6 h1 l& c7 d6 p$ |: }' S: Bgyp ERR! find VS/ s8 Q/ P0 {3 C9 C4 s9 w
gyp ERR! configure error) p4 i; M3 x/ x
gyp ERR! stack Error: Could not find any Visual Studio installation to use
& _0 T% B9 p% X) Vgyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
* v1 e$ E* Z6 W6 K3 c6 Y, x) `dio.js:121:47)
" C* c7 x$ E3 w- W3 }% _gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
* M1 e1 J8 _. [' k( Egyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
: ?% J. V# ?4 o; z. A) Tgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7. i8 l3 ~; S4 J# K1 M* l
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:163 a' L- w  {3 N' r! f
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
& z% Z7 W6 I: U3 p: ugyp ERR! stack     at ChildProcess.emit (events.js:315:20)
- J1 D" d4 t5 c  k2 ]  t1 Tgyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
7 q- k  ]/ k5 A+ w- N0 |gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)/ X0 U: H  q/ N9 F; y
gyp ERR! System Windows_NT 10.0.15063
, S) U- q* S+ S4 H

4 O; F! ?! R, z# n解决办法
- i! F' h$ I1 ?. x* G- P1、卸载nodejs重新安装一遍; Y$ k$ H' e+ m! Z3 z
1 c& p' w( m) K6 m' G
2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org+ z$ _6 }) d* J3 \. c$ r* w+ a
% a. [7 T' E# _! o  d
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
9 t0 Z* D! u) \) R————————————————+ R% @3 Q  A& J! ~+ U9 Q2 t
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
5 c5 y3 Z8 A' }) h' J原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

334

主题

517

回帖

3394

积分

管理员

积分
3394
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7
1 E6 L  C; X7 E. |: U. Y' Z
" p' `+ K( C$ ~( ?由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。
' {; @% ]3 L5 Z/ ^6 T0 x
* t  r. L+ b2 J0 E6 t然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!$ H! b9 a9 C8 f2 l
————————————————* K. G% h0 x% a0 [; {; Q9 r
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
3 n' z6 }7 T- X8 z) D( F原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 23:32 , Processed in 0.074552 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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