尝试安装依赖项时,npm 失败并显示错误代码 ETARGET

Mik*_*e K 5 linux npm jenkins typescript reactjs

编辑

对于未来来到这里的任何人,请运行npm get registry并确保它指向https://registry.npmjs.com

我的指向的是 Nexus 注册表,该注册表暂时没有我需要的包。


我有一个基本项目,Jenkins 作业克隆其存储库并运行,

npm install && npm run build
Run Code Online (Sandbox Code Playgroud)

最终,它失败并出现以下错误:

npm install && npm run build
Run Code Online (Sandbox Code Playgroud)

所请求的版本已存在

我已经尝试了我能想到的一切。我试过,

  • 省略我的yarn.lock文件
  • 切换到 package-lock.json 以查看这是否是问题所在
  • 省略 package-lock.json
  • 跑步rm -rf node_modules && rm -rf yarn.lock && npm cache clean --force && npm install && npm run build
  • 添加@typescript-eslint/experimental-utils@4.14.1到我的依赖项package.json

奇怪的是本地运行yarn && yarn startnpm install && npm run start工作得很好。

老实说,我不知道我在这里错过了什么,我已经拉了我的头发好几个小时了。

我在网上查看了无数的解决方案,但没有一个适合我。

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @typescript-eslint/experimental-utils@4.14.1.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of '@typescript-eslint/eslint-plugin'
npm ERR! notarget 

npm ERR! A complete log of this run can be found in:
Run Code Online (Sandbox Code Playgroud)
$ npm -v
v6.13.4
Run Code Online (Sandbox Code Playgroud)