欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 文化 > npm install 报错:Command failed: git checkout 2.2.0-c

npm install 报错:Command failed: git checkout 2.2.0-c

2025/3/15 8:23:03 来源:https://blog.csdn.net/freflying1119/article/details/145274105  浏览:    关键词:npm install 报错:Command failed: git checkout 2.2.0-c

[TOC](npm install 报错:Command failed: git checkout 2.2.0-c)

npm install 报错:Command failed: git checkout 2.2.0-c

export NODE_HOME=/usr/local/node-v14.14.0-linux-x64
npm config set registry https://registry.npmmirror.com

使用如上环境,编译一个前端项目,开发说本地编译成功,但是jenkins编译始终报错:

npm ERR! code 1
npm ERR! Command failed: git checkout 2.2.0-c
npm ERR! 错误:路径规格 '2.2.0-c' 未匹配任何 git 已知文件
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2025-01-20T07_22_50_221Z-debug.log

上面的信息如何查都没有用,检查日志/root/.npm/_logs/2025-01-20T07_22_50_221Z-debug.log,也没有找到有用的信息:

3882 warn notsup Unsupported engine for commander@13.0.0: wanted: {"node":">=18"} (current: {"node":"14.4.0","npm":"6.14.5"})
3883 warn notsup Not compatible with your version of node/npm: commander@13.0.0
3884 verbose notsup Not compatible with your version of node/npm: commander@13.0.0
3884 verbose notsup Required: {"node":">=18"}
3884 verbose notsup Actual:   {"npm":"6.14.5","node":"14.4.0"}
3885 verbose stack Error: Command failed: git checkout 2.2.0-c
3885 verbose stack 错误:路径规格 '2.2.0-c' 未匹配任何 git 已知文件
3885 verbose stack
3885 verbose stack     at ChildProcess.exithandler (child_process.js:303:12)
3885 verbose stack     at ChildProcess.emit (events.js:315:20)
3885 verbose stack     at maybeClose (internal/child_process.js:1051:16)
3885 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
3887 verbose Linux 3.10.0-1160.el7.x86_64
3888 verbose argv "/usr/local/node-v14.4.0-linux-x64/bin/node" "/usr/local/node-v14.4.0-linux-x64/bin/npm" "install"
3889 verbose node v14.4.0
3890 verbose npm  v6.14.5
3891 error code 1
3892 error Command failed: git checkout 2.2.0-c
3892 error 错误:路径规格 '2.2.0-c' 未匹配任何 git 已知文件
3893 verbose exit [ 1, true ]

定位过程

1、尝试切换不同的Node版本,问题依然存在,仍然看不出问题;
2、切换不同代理,也不行;
3、开发始终坚持本地能编译过,但是给了一个建议,使用cnpm编译试试;
4、尝试安装cnpm,需要至少NodeV14.18.0;
5、安装nodeV14.18.0, 再安装cnpm;
6、使用cnpm install, 报错:
在这里插入图片描述

7、狐狸尾巴总算漏出来了,跟tui-editor依赖有关。
8、上网搜搜tui-editor信息,找到这篇文章“npm install 安装tui-editor报错解决”

其原因是“原先的tui-editor插件(富文本编辑器插件)换了个名称,现在已经更名为toast-ui/editor,因此安装不了,从而报错!”

9、把情况通报给开发人员,开发说想起来了,确实他们原来也编译不过,后来有人给了他们一个资源文件,他们本地才编译通过的。

10、开发进一步尝试把本地的node_modules删除,然后本地也编译不过去了。

至此,问题真相大白。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词