'create-react-app : npm ERR! notarget No matching version found for [email protected]

I'm trying to create a new react project with create-react-app as usual :

npx create-react-app .

But I'm getting an error :

npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

I've checked and the package toidentifier 1.0.1 is available in the repo. I don't understand why I'm getting this error.

I am also able to get the same error when trying to npm i on an existing project that uses react-scripts. The error is quite recent, I've never had any problem of this kind previously.

I'm using node 17.0.1 and npm 8.1.0 What could be wrong ?

Edit : I also tried with node 17.6.0 and npm 8.5 and the same thing happens



Solution 1:[1]

If you encouter the same error, it's probably due to your local npm cache which isn't up to date and inconsistent.

Run npm cache clean --force to ensure that the package and dependencies lists will be updated.

This happened to me with the toidentifier package which is a low-level dependency used in various packages, including some webpack dependencies. It's likely that this error may occur with some other packages.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ibi0tux