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

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

[复制链接]

335

主题

520

回帖

3437

积分

管理员

积分
3437
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:
! W) Z+ y) u5 w
```bash
9 j1 j* K9 }/ `. H: R% M% qgyp ERR! find VS
- v/ T" ^$ y" G' Z% [$ Z4 Hgyp ERR! find VS msvs_version not set from command line or npm config
7 C* X+ Y( \- j5 ]. lgyp ERR! find VS running in VS Command Prompt, installation path is:' k0 a1 W7 r) o! `
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017", Z# t( S1 q" c' S+ ]7 s5 l
gyp ERR! find VS - will only use this version0 z  P" p  {% u- |% C+ h
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
  \8 N" K4 t: z. v5 R9 Sgyp ERR! find VS looking for Visual Studio 2015& n6 U3 _& d  ]5 Z6 L. f
gyp ERR! find VS - not found0 x8 W3 j" ]1 V! q# n& |; s
gyp ERR! find VS looking for Visual Studio 2013
, \" z0 y4 e0 W7 i0 ngyp ERR! find VS - not found
$ U7 O* p9 E4 Z' P5 b% \  J" G  ugyp ERR! find VS
4 N) b4 S" ]+ \% ~) p; |* I7 Y5 n5 Pgyp ERR! find VS **************************************************************
; [) u- ~: \4 i$ j( x5 ~) e; T+ Igyp ERR! find VS You need to install the latest version of Visual Studio
+ {$ R, P8 _1 Y, ]gyp ERR! find VS including the "Desktop development with C++" workload.
6 P1 t6 @2 ?4 o5 kgyp ERR! find VS For more information consult the documentation at:
% u) k2 I% y5 |) R* N/ F3 Ggyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows+ I6 V* v0 }) A8 r' U; A
gyp ERR! find VS **************************************************************
6 x1 ?& F* _( ~gyp ERR! find VS
* X; u1 Z2 U* I. \" s8 {gyp ERR! configure error
! [* i  y  t8 {) k9 B0 xgyp ERR! stack Error: Could not find any Visual Studio installation to use
' z( k1 N% E, w5 H3 t) p% e& Wgyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu+ m1 i, ?( T( i" R  \& h8 e) S- z
dio.js:121:47)( w+ L  E5 o7 L5 z5 ~& R
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16# q1 ]0 j9 w5 L
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16
6 v/ a+ B  n4 f& M) \/ N5 Wgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
) l& B+ P0 k' ^4 E' H+ zgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:164 u( ~! ?0 o3 G6 }+ x5 [3 }" ?
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
* a% i% E* \- fgyp ERR! stack     at ChildProcess.emit (events.js:315:20)
, L0 o! f8 V6 c) }, W! E6 `gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)- |; z; ?, c  A9 _5 P( ?2 g* I& s
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
: t0 [( v# B+ ?# jgyp ERR! System Windows_NT 10.0.15063

  `; b& p' \3 Z; o
4 S; @4 F9 p+ J) v0 G2 a$ c解决办法% g! u/ p* M# o
1、卸载nodejs重新安装一遍
, B9 s2 u( k9 b0 D
* i% Q' ?& C$ ]& r" F( `" {2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
( N3 o3 V! s- {* ^' c& P* c9 b, Y, f% u
3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools
5 I; V& E$ _! P8 _6 T( u6 A8 h————————————————# ]  F1 @  p; X( P+ M
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。+ B" [9 X& t5 ~  }, P
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

335

主题

520

回帖

3437

积分

管理员

积分
3437
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.7. J' x% N# V: h& X! z8 K
1 c& Y1 y, X! G  ~
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。3 H5 L& \$ L3 p7 [' I- G

6 w( B. F: F+ W- M. ]0 e然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!
* g; D# x$ W; C. }. D————————————————
3 m; |- B" t/ `9 @9 P版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。' ^+ H1 Q8 _5 h# @4 f# c
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 16:04 , Processed in 0.077406 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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