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

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

[复制链接]

408

主题

596

回帖

4038

积分

管理员

积分
4038
QQ
发表于 2023-8-28 23:03:22 | 显示全部楼层 |阅读模式
报错信息:  _* k- Q9 d6 z" s
```bash
) o1 j/ n8 B) W5 s; T% x7 ^gyp ERR! find VS
# m3 {7 j# ?* a  G. ugyp ERR! find VS msvs_version not set from command line or npm config2 [- G; P3 }! [1 `- g
gyp ERR! find VS running in VS Command Prompt, installation path is:( G, M! n8 y( W' u
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"5 l+ [) C2 j: ?' F) R
gyp ERR! find VS - will only use this version& v4 p" w8 [7 H8 p' u: O
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
5 A; x" _* ^, F$ O- \  x+ U; G1 a) v# ?4 igyp ERR! find VS looking for Visual Studio 2015
5 o# r1 @4 h+ R- z' mgyp ERR! find VS - not found8 d  R% b6 u6 Z6 n
gyp ERR! find VS looking for Visual Studio 2013
! ?, z3 [2 {. Y/ E4 agyp ERR! find VS - not found
+ i: A* A3 O% d# M& z9 P1 lgyp ERR! find VS0 V; F+ r3 O' A
gyp ERR! find VS **************************************************************
+ [0 T+ {1 a' J7 ]) x; s8 ggyp ERR! find VS You need to install the latest version of Visual Studio4 X; t# u, S2 V! [% f5 O8 y, L
gyp ERR! find VS including the "Desktop development with C++" workload.% f" V& ~( d7 V7 F  d+ Y
gyp ERR! find VS For more information consult the documentation at:" Z' ]; a7 A" ^2 B# I" B4 ^
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows7 i5 `& s9 Z% |# g2 M" m- C! z
gyp ERR! find VS **************************************************************
3 q! A6 C( m1 ]+ ]gyp ERR! find VS; q6 H  F! q) m/ O6 n
gyp ERR! configure error7 V% w& ?/ e7 X6 s' }/ ^5 @# |
gyp ERR! stack Error: Could not find any Visual Studio installation to use
+ v$ s6 \" ^% h" h9 ^+ ^* Wgyp ERR! stack     at VisualStudioFinder.fail (D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstu
7 ]8 u2 o& ~7 |2 w$ L% ndio.js:121:47)
3 V- i* y# G3 C4 C  ~: |gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:74:16
" L( n5 s- l  i( sgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\find-visualstudio.js:372:16# v: j* B3 u- I2 G. N1 J7 a
gyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:54:7
: i, p6 J7 R) y$ O/ Fgyp ERR! stack     at D:\rymcu\electron-serialport\node_modules\node-gyp\lib\util.js:33:16
) K9 T8 }! u. t  x2 j$ V. k+ q* Dgyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)2 F+ u% V. U+ c1 O* i+ Y/ l
gyp ERR! stack     at ChildProcess.emit (events.js:315:20), P) g# B% u: [; D
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
  K9 r: s0 T, g* n: N; c; h1 Ggyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
, _* s- N  e* k$ b& `. A8 p/ Ggyp ERR! System Windows_NT 10.0.15063
0 [1 c9 ~. O/ ^# g1 P2 N8 a

/ T, m4 f0 T4 A9 `' [# _. a( @解决办法
0 b, T9 L% p3 P) c+ ~1、卸载nodejs重新安装一遍, r2 A9 y, Q8 @( F2 M, F

/ `( G9 }3 B* t  P; [1 H' p- q2 }. H2、设置淘宝镜像 npm config set registry https://registry.npm.taobao.org
, e5 b& b1 x: @
# j, ^% @$ ~0 b& x, P3、安装nodejs所需的环境(Visual Studio XX、python什么鬼的),执行这个命令会自动检测并帮你安装好,npm install --g --production windows-build-tools) O$ u' C  n8 }* J, z0 Z- r
————————————————
& ]. X# V+ h& T版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。) @0 k% R. r9 i) h; R$ _
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

408

主题

596

回帖

4038

积分

管理员

积分
4038
QQ
 楼主| 发表于 2023-8-28 23:03:39 | 显示全部楼层
4、关键所在!!!执行编译时指定python版本,npm install --python=python2.70 n  g2 W" B" H) t8 f
: `* J8 G' p! K; U
由于我的电脑之前安装过python3版本,并且设置了环境变量,所以npm install会找我默认的python,所以执行时指定nodejs只支持的python2版本。7 y+ a; V8 o0 a6 o
3 @4 J7 Y) Z$ W9 z
然后,神奇的事情到了,我把编译包modules删掉后重新编译(这次不指定python2版本直接npm install),居然奇迹般的又没有报错!!!想不通。。。难道npm会将上次编译成功的配置保存下来??算了不纠结了哭泣!; X1 G2 w! y' N$ p+ W, @$ M" @* L- a
————————————————6 X( T# q& p1 T9 m$ C2 l( r
版权声明:本文为CSDN博主「一点一滴成长」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。0 Q1 V+ o7 w1 S: \" z* I' Y
原文链接:https://blog.csdn.net/qq_39946015/article/details/127351920
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-4-11 17:23 , Processed in 0.514169 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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