[npm error] Solve invalid json response body at https://registry.npmjs.org

Error message:
npm error

npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/@riophae%2fvue-treeselect reason: Invalid response body while trying to fetch https://registry.npmjs.org/@riophae%2fvue-treeselect:

The reason for the error is that the versions of node and npm are too high. I installed the latest version at the time, and the latest version often has errors. It is recommended to lower the version (I have tried to replace the Taobao source and npm cache clean --force, but the problem cannot be solved)

Solution
1. Uninstall node.js
1. Open [Control Panel], find [Uninstall a program] in the control panel window, and click Open.
Select node.js, then right-click and select [Uninstall]
2. Find out node and npm related files and delete them
such as:
C:\Users\username\AppData\Roaming
C:\Program Files\nodejs

3. Delete the .npmrc file under C:\Users\username

4. Delete all environment variables of npm and node

2. Install a lower version of node.js
1. Click on the previous version address of the nodejs official website
2. Select the appropriate version
I chose the version beginning with [email protected]
node and npm versions
3. After clicking download, select the file with the .mis suffix to download
insert image description here
4. After installation Just configure the environment variables.

You can refer to the link nodejs environment variable configuration

Guess you like

Origin blog.csdn.net/qq_41612593/article/details/128670363