I tried to clone a project and run npm install and came across this error:
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
I already googled and found some answers myself where a user was having problems with babel modules and the owner redirected it to here: https://gist.github.com/hzoo/df94af2d2ec48696e683b772c775aa67
We use a proxy for our company npm package, although I removed it from package.json for testing whether the issue was due to that, but still got the same problem.
npm cache clean --force
npm cache verify
npm config rm proxy
npm config rm https-proxy
but no luck
Here is my 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"
}
}
This happens because that version was published yesterday on the NPM registry but your company's registry is not up to date.
SOLUTION: open '.npmrc' which is located in your root. Comment out your first registry like this:
# registry=http://*******/*******/*****/
and add this:
registry=https://registry.npmjs.org/
Install that package version you need and then change back these 'registry' lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With