[英]How to force npm not to create symbolic link to local package?
I downloaded local copy of npm package and extracted it on desktop.我下载了 npm 包的本地副本并将其解压缩到桌面上。 Then I used npm install /directory/
to install it.然后我使用npm install /directory/
来安装它。
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.经过进一步调查,我注意到该包在node_modules
但它旁边有箭头,上面写着“符号链接”,我认为它是指向此包的桌面目录的链接。
How do I install it independently so that it is fully contained in node_modules allowing me to remove desktop copy?我如何独立安装它以便它完全包含在 node_modules 中,允许我删除桌面副本?
Turns out you can use原来你可以使用
npm pack /path/to/package
This will cause npm to pack package into a .tgz
file.这将导致 npm 将包打包到.tgz
文件中。 Then you can install it from a .tgz
file using a standard然后您可以使用标准从.tgz
文件安装它
npm install /path/to/file.tgz
This will force npm to create local copy in node_modules
without symbolic link这将强制 npm 在没有符号链接的情况下在node_modules
创建本地副本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.