简体   繁体   中英

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?

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 local copy in node_modules without symbolic link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM