npm install失败的通用方法

以后遇到npm install莫名其妙的报错
什么 Failed to set up Chromium r818858
什么 Protocol “https:” not supported. Expected “http:”
这种莫名其妙的问题

首先问成功的人是node多少版本
然后

npm uninstall *
npm install

如果不行,在外面

npm uninstall *

然后再进项目文件夹 uninstall install


针对于公司环境
在外面设置代理,不要在项目文件夹配置代理
然后进项目文件夹 uninstall install


如果出现版本冲突,如 A 包只支持 B 包的 x 版本,各种缠绕,难以通过只修改几个包版本的方式解决,可以试试 yarn install


Node 16 6.0+ 93
Node 15 5.0+ 88
Node 14 4.14+ 83
Node 13 4.13+, <5.0 79
Node 12 4.12+ 72
Node 11 4.10+, <5.0 67
Node 10 4.9+, <6.0 64
Node 8 4.5.3+, <5.0 57
Node <8 <5.0 <57


gyp ERR! configure error /child_process:1092:16)
gyp ERR! stack Error: Command failed: C:\Users\dle.onexit (node:internal/child_process:302:5)chongy.wang\AppData\Local\Programs\Python\Python310\python.EXE -c import sys; print “%s.%s.%s"de.exe” “D:\tmp\NextTVPlus-develop\node_modules\node-gyp\bin\node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=” % sys.version_info[:3]; ules\node-sass
gyp ERR! stack File “”, line 1
gyp ERR! stack import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gyp ERR! stack SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (node:child_process:398:12)
gyp ERR! stack at ChildProcess.emit (node:events:527:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command “C:\Program Files\nodejs\node.exe” “D:\tmp\NextTVPlus-develop\node_modules\node-gyp\bin\node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
gyp ERR! cwd D:\tmp\NextTVPlus-develop\node_modules\node-sass
gyp ERR! node -v v16.16.0

python版本不对。print 不加括号只有 python 2 支持


error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads https://github.sec.xxx.net/XXXX/s2-ad.git
Directory: D:\tmp\XXXXXXXXX
Output:
error: RPC failed; curl 28 Failed to connect to github.sec.xxx.net port 443 after 21043 ms: Timed out
fatal: expected flush after ref listing
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

网络不好,过一会就好了


yarn add s2-ad2@https://github.sec.XXXXXXXX.git
yarn : The term 'yarn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ yarn add s2-ad2@https://github.sec.samsung.net/VD8-vdserviceclient/s2 ...
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (yarn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

改用 npx yarn add

同样,只要找不着 yarn 都用 npx yarn

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值