How do I uninstall a package installed using npm link?

前端 未结 5 1944
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 15:42

When installing a node package using sudo npm link in the package\'s directory, how can I uninstall the package once I\'m done with development?

n

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 16:26

    npm link pain:

    -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:

    Option 1: Unlink via npm:

    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


    Option 2: Remove the symlink like a normal linux guru

    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

提交回复
热议问题