Search code examples
node.jsnpmnpm-installnpm-package

How to force npm not to create symbolic link to local package?


I downloaded local copy of npm package and extracted it on desktop. Then I used npm install /directory/ to install it.

What I noticed is that when I remove desktop directory, app says it can't find installed module. After further investigation I noticed that package is in node_modules but it has arrow next to it and it says "symbolic link" which I suppose is a link to desktop directory with this package.

How do I install it independently so that it is fully contained in node_modules allowing me to remove desktop copy?


Solution

  • Turns out you can use

    npm pack /path/to/package
    

    This will cause npm to pack package into a .tgz file. Then you can install it from a .tgz file using a standard

    npm install /path/to/file.tgz
    

    This will force npm to create a local copy in node_modules without symbolic link