0

I have installed node-gyp in order to install scrypt. While installing the node-gyp package the following two packages were installed along with it:

101@1.6.3

d@1.0.1

I have tried to remove these two packages, realising that I did not need the node-gyp and scrypt packages, but sudo npm uninstall does not remove them. How can I uninstall these packages?

user229044
  • 232,980
  • 40
  • 330
  • 338
JF0001
  • 819
  • 7
  • 30
  • Why do you want to install these packages? Are they dependencies of node-gyp? What does the package-lock.json indicate they are dependencies of? – Alexander Staroselsky Apr 07 '21 at 02:31
  • Thank you @AlexanderStaroselsky I have not explicitly installed them, but they were installed with node-gyp. I have since removed node-gyp (and thus cannot verify the dependencies), but wasn't able to remove these two packages. – JF0001 Apr 07 '21 at 02:34
  • Please don't sign your posts with repetitive taglines like "Thank You, J". Your posts are all "signed" by your usercard already. – user229044 May 02 '21 at 02:20

2 Answers2

2

If your package.json file contains entries for these modules (101@1.6.3 and d@1.0.1), delete those lines.

Then delete your package-lock.json file.

Then delete your node_modules folder.

Now run npm install

Bishan
  • 15,211
  • 52
  • 164
  • 258
  • Thank you @Bishan. Actually, since the node-gyp site (https://www.npmjs.com/package/scrypt) suggested to install this package (which has installed the two packages that I am trying to remove) globally, these two packages were installed globally as well. I can delete the folders in my node_modules, but it is strange that the npm uninstall command is not working. I would have liked to remove them properly from my system. – JF0001 Apr 07 '21 at 03:32
  • @JF0001 Read [Where does npm install packages?](https://stackoverflow.com/questions/5926672/where-does-npm-install-packages) and follow above steps to remove Global libraries – Bishan Apr 07 '21 at 03:53
1

Its Depends on how you have installed those packages.

if it's a local package to the project

use "npm uninstall --save 'package name'" or simply remove the package from package.json of your project. Then Delete node_modules folder and install npm again using "npm install"

if it's a global package use [sudo] npm uninstall -g "package name"

use sudo based on which OS your are using .

  • Incorrect. Use sudo only if NPM is installed in /usr on Linux. Users using [n] with a custom prefix do not need to. – 0xLogN Apr 07 '21 at 03:08