8

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?

inspiredtolive
  • 161
  • 2
  • 3
  • 7
  • Is it possible you've installed it with your OS package manager as well as NPM? – tadman Nov 01 '17 at 20:10
  • @tadman Maybe. It's been over a year and a half since I first installed it so I don't remember how I installed it, but was there any other way to install it besides npm at that time? How can I check this? – inspiredtolive Nov 01 '17 at 20:55
  • Some distributions package NPM packages like that using RPM or DEB depending on your package manager. It's worth checking if they're responsible for that particular file. – tadman Nov 01 '17 at 21:02
  • Sorry. I flagged it as a possible duplicate, but gave the wrong link. I meant to suggest it is a duplicate of [https://stackoverflow.com/questions/47763783](https://stackoverflow.com/questions/47763783). – Henke Jul 07 '20 at 14:50

4 Answers4

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

N.K.
  • 301
  • 1
  • 8
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
FDisk
  • 8,493
  • 2
  • 47
  • 52
0

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.

inspiredtolive
  • 161
  • 2
  • 3
  • 7
0

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