How to Remove a Package with npm Uninstall. To remove a package with the npm uninstall command, you can use the syntax npm uninstall package-name in the directory where the package is located.
You can βundoβ the effects of npm link by simply removing the symbolic links. But there is a built in command for it, aptly called: npm unlink . Just run npm unlink --no-save <module_name> on your project's directory to remove the local symlink, and run npm unlink on the module's directory to remove the global symlink.
The package can be uninstalled using the same uninstall or rm command that can be used for removing installed packages. The only thing to keep in mind is that the link needs to be uninstalled globally - the --global
flag needs to be provided.
In order to uninstall the globally linked foo
package, the following command can be used (using sudo
if necessary, depending on your setup and permissions)
sudo npm rm --global foo
This will uninstall the package.
To check whether a package is installed, the npm ls
command can be used:
npm ls --global foo
you can use unlink
to remove the symlink.
For Example:
cd ~/projects/node-redis
npm link
cd ~/projects/node-bloggy
npm link redis # links to your local redis
To reinstall from your package.json:
npm unlink redis
npm install
https://www.tachyonstemplates.com/npm-cheat-sheet/#unlinking-a-npm-package-from-an-application
-Module name gulp-task
-Project name project-x
You want to link gulp-task:
1: Go to the gulp-task directory then do npm link
this will symlink the project to your global modules
2: Go to your project project-x then do npm install
make sure to remove the current node_modules directory
Now you want to remove this madness and use the real gulp-task, we have two options:
1: Go to your project and do npm unlink gulp-task
this will remove the linked installed module
2: Go to the gulp-task directory and do npm unlink
to remove symlink. Notice we didn't use the name of the module
3: celebrate
What if this didn't work, verify by locating your global installed module. My are location ls -la /usr/local/lib/node_modules/
if you are using nvm it will be a different path
1: locate your global dependencies cd /usr/local/lib/node_modules/
2: removing symlink is simply using the rm
command
rm gulp-task
make sure you don't have /
at the end
rm gulp-task/
is wrong π₯π¨
rm gulp-task
βοΈ
If you've done something like accidentally npm link
generator-webapp after you've changed it, you can fix it by cloning the right generator and linking that.
git clone https://github.com/yeoman/generator-webapp.git;
# for fixing generator-webapp, replace with your required repository
cd generator-webapp;
npm link;
"npm install" replaces all dependencies in your node_modules installed with "npm link" with versions from npmjs (specified in your package.json)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With