To uninstall npm globally, you can use the following command:

$ npm uninstall npm -g

Make sure to replace uninsall with uninstall.

If you still encounter an error, try running the command as an administrator or with elevated privileges.

If the issue persists, you can manually remove the npm installation directory. The default location for npm global packages is:

  • macOS/Linux: /usr/local/lib/node_modules
  • Windows: C:\Users\{your_username}\AppData\Roaming\npm\node_modules

Delete the npm folder from the respective directory.

Afterwards, you can verify if npm was uninstalled successfully by running npm -v command. If it returns an error, it means that npm has been successfully uninstalled

~ $ npm uninsall npm -gUnknown command uninsallDid you mean one of these npm install # Install a package npm uninstall # Remove a packageTo see a list of supported npm commands run npm help解决办法

原文地址: https://www.cveoy.top/t/topic/hM9w 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录