See https://github.com/npm/npm/issues/16861
This worked for me:
npm cache verify
Then I re-ran:
npm install -g create-react-app
And it installed as expected: Issue resolved.
Other solutions mentioned in the GitHub issue include:
npm cache clean --force
OR
Deleting npm and npm-cache folders in Users%username%\AppData\Roaming (Windows 7 and Windows 10) and running npm install
OR
Update npm by via npm i -g npm
OR
Delete package-lock.json
OR
npm cache clean
OR
Do these steps to fix the problem:
- Find all outdated packages and update theme:
npm outdated -g
sudo npm i -g outDatedPKG - Upgrade npm to latest version with:
sudo npm i -g npm - Delete
package-lock.jsonfile. - Delete
_cacachedirectory in~/.npm:
npm cache verify - Every time I get that error, do steps 2 & 3.
- If you still get the error, clear npm’s cache:
npm cache clean --force
OR
- Add proxy to
.npmrcin~directory:
proxy=http://localhost:8123
https-proxy=http://localhost:8123
- Try again! slow internet connection and censorship may cause this ugly problem.
OR
npm cache clear --force && npm install --no-shrinkwrap --update-binary
OR
npm config set package-lock false