npm install npm -g won't update npm to the latest version

前端 未结 6 1329
刺人心
刺人心 2021-02-19 06:17

I am using npm v5.3.0. Now I want to update npm to v5.4.1.To do this I type the following in my terminal:

npm install -g npm

without any errors.Howe

6条回答
  •  时光取名叫无心
    2021-02-19 06:32

    I was facing the same error today. I updated node. Since npm comes bundled with node, npm was also updated but updated npm version was not reflecting. I, also, tried to update npm version by using commands npm install -g npm@latest. But, the version was not reflecting.

    This is how I resolved it.

    1. A lot of post suggested to use the command npm cache clean --f. But, it did not work for me. Hence, I deleted the "npm" and "npm-cache" folders from the location C:\Users\SearchYourUserName\AppData\Roaming

    2. Uninstalled again the existing node.

    3. Re-Installed node version v10.x.x. I downloaded the node-v10.22.1-x64.msi file from https://nodejs.org/dist/latest-v10.x/ and installed it.

    Then checked the npm version. It had worked.

提交回复
热议问题