reactjs 找不到@babel/traverse@^7.14.0的匹配版本

hsgswve4  于 2022-12-22  发布在  React
关注(0)|答案(4)|浏览(397)

我尝试克隆一个项目并运行npm安装,但遇到了此错误

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

我已经在谷歌上找到了一些答案,其中一个用户有问题的巴别塔模块和业主重定向到这里:https://gist.github.com/hzoo/df94af2d2ec48696e683b772c775aa67
我们为我们公司的npm包使用了一个代理,尽管我从包json中删除了它,以测试问题是否与此有关,但仍然得到了相同的问题

npm cache clean --force
npm cache verify
npm config rm proxy
npm config rm https-proxy

但没有运气
这是我的包. 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"
  }
}
lsmepo6l

lsmepo6l1#

发生这种情况是因为该版本是昨天发布的NPM注册,但你的公司注册不是最新的。

    • 溶液**:打开位于根目录下的."npmrc"。注解掉第一个注册表,如下所示:
# registry=http://*******/*******/*****/

加上这个

registry=https://registry.npmjs.org/

安装您需要软件包版本,并更改这些"注册表"行

gzjq41n4

gzjq41n42#

我运行了npm医生,看看是什么问题,并意识到我不能删除我的注册表,所以医生说我应该设置注册表为https://registry.npmjs.org/,虽然我有.npmrc文件,它补充。删除后,安装继续,虽然来自我们公司的软件包不能,这是另一个问题要解决

q5lcpyga

q5lcpyga3#

设置此npm配置集注册表= registry.npmjs.org/并安装npm

tcomlyy6

tcomlyy64#

您运行的是过时版本的npm,它无法识别该版本的@babel。
运行npm update,然后尝试再次克隆项目,它应该工作。

相关问题