我尝试克隆一个项目并运行npm install并遇到此错误:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @babel/traverse@^7.14.0.
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 '@babel/helper-module-transforms'
npm ERR! notarget
Run Code Online (Sandbox Code Playgroud)
我已经在谷歌上搜索并找到了一些答案,其中用户遇到了 babel 模块的问题,所有者将其重定向到这里:https ://gist.github.com/hzoo/df94af2d2ec48696e683b772c775aa67
我们为我们公司的 npm 包使用了代理,尽管我将其从 package.json 中删除以测试问题是否是由于该问题引起的,但仍然遇到了同样的问题。
npm cache clean --force
npm cache verify
npm config rm proxy
npm config rm https-proxy
Run Code Online (Sandbox Code Playgroud)
但没有运气
这是我的 package.json
{
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.3",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.8.3",
"@types/node": "^12.20.6",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"eslint-config-react-app": "^6.0.0",
"eslint-config-react-app-tsc": "^6.0.0-rc.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-facebook": "^8.1.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-slick": "^0.28.1",
"react-twitter-embed": "^3.0.3",
"reactjs-popup": "^2.0.4",
"sp-rest-proxy": "^3.0.5",
"typescript": "^4.2.4",
"web-vitals": "^1.1.1"
},
"scripts": {
"server": "node server.js",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/jquery": "^3.5.5",
"@types/react-router-dom": "^5.1.7",
"@types/react-slick": "^0.23.4",
"bootstrap": "^4.6.0",
"eslint-config-react": "^1.1.7",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"react-app": "^1.1.2"
}
}
Run Code Online (Sandbox Code Playgroud)
Jan*_*ovs 10
发生这种情况是因为该版本昨天已在 NPM 注册表上发布,但您公司的注册表不是最新的。
解决方案:打开位于根目录中的“.npmrc”。像这样注释掉你的第一个注册表:
# registry=http://*******/*******/*****/
Run Code Online (Sandbox Code Playgroud)
并添加以下内容:
registry=https://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)
安装您需要的软件包版本,然后改回这些“注册表”行。
| 归档时间: |
|
| 查看次数: |
29526 次 |
| 最近记录: |