'Can't global uninstall npm package (eslint) OS X
I have eslint installed and I wanted to update it to a newer version. Upon trying to do this, I found out that I can't get rid of my current version of eslint.
I tried uninstalling via npm but it doesn't seem to remove the command.
$ eslint -v
v3.0.1
$ npm uninstall -g eslint
<a huge list of eslint node_modules>
$ eslint -v
v3.0.1
I tried checking where the command was from and where my global packages were saved but I am not sure what to do with this information.
$ which eslint
/usr/local/bin/eslint
That file was an alias to /usr/local/lib/node_modules/eslint/bin/eslint.js
$ npm list -g
/Users/inspiredtolive/.nvm/versions/node/v7.10.0/lib
<list of packages>
All I really want to do is install eslint with the version greater or equal to 4.9.0. What should I do?
Solution 1:[1]
You probably installed global npm package in an older node version. If this is the case reinstall all global packages to latest version directory by running
nvm reinstall-packages
then
npm remove eslint
Solution 2:[2]
Maybe you have installed eslint
globally via yarn
. Try yarn global remove eslint
.
BTW global yarn modules are saved here: disk:\Users\Username\AppData\Local\Yarn\Data\global\node_modules
Solution 3:[3]
I couldn't figure out how my eslint was originally installed, but I ended up replacing the alias file at /usr/local/bin/eslint
with an alias file that points to /Users/inspiredtolive/.nvm/versions/node/v7.10.0/lib/node_modules/eslint/bin/eslint.js
and now it correctly uses the globally installed npm package.
Solution 4:[4]
use from last version node for uninstall eslint. you can use from nvm for show node installed . and switch to last version
npm uninstall eslint --save
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 | FDisk |
Solution 2 | N.K. |
Solution 3 | inspiredtolive |
Solution 4 | fattah behmadi |