npmnpm-install

How to uninstall unwanted/extra npm packages


I had mysql installed through mySQL workbench, but i wasn't sure so i ran the command "npm install mysql" and it added 11 packages and audited 12. Now I don't want the extra added packages, but I am afraid that if I run the command "npm uninstall mysql", it can affect the packages I installed through mySQL workbench. Is there a way to fix this?

I was trying to install packages which I later realized I didn't need.


Solution

  • You can safely run npm uninstall mysql for the following reasons:

    1. MySQL workbench does not use npm to install things; MySql was installed on your system without the use of npm.
    2. npm packages are not typically installed globally, meaning that you install/delete them for specific projects without affecting the rest of your system.
    3. The npm package you installed by running npm install mysql does not, in fact, include MySQL nor a server to run. It is only a driver that allows you to connect to an already running instance of MySql.

    That said, given what you are describing above, I believe that you do intend to connect to MySql from your node application later on, in which case you would need the driver package, after all.