3

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?

ablaszkiewicz1
  • 855
  • 1
  • 10
  • 26
  • How did you download the "local copy"? Is it something not on the online repository? – user202729 Nov 08 '21 at 10:43
  • It is a paid javascript library and it's not hosted on any site. You get direct download link to it. It is an npm package though. It has `package.lock` file in it, javascript code and ts type definitions. – ablaszkiewicz1 Nov 08 '21 at 10:46
  • Do they have documentation on how to install it (probably in their README or somewhere), then? – user202729 Nov 08 '21 at 10:48
  • Okay you get your answer here. https://stackoverflow.com/questions/8088795/installing-a-local-module-using-npm#comment102170132_8089029 – user202729 Nov 08 '21 at 10:49
  • 1
    This doesn't resolve my issue. I resolved it other way and posted below. – ablaszkiewicz1 Nov 08 '21 at 10:55

1 Answers1

9

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

ablaszkiewicz1
  • 855
  • 1
  • 10
  • 26