简体   繁体   English

是否安装没有符号链接的npm本地模块目录?

[英]Install npm local module directory without symlinks?

So here is the simple file layout. 所以这是简单的文件布局。

/my-module
..package.json
/my-app
..package.json

I want my-app to install my-module locally. 我希望my-app在本地安装my-module I tried this: 我尝试了这个:

"dependencies": {
    "myModule": "../my-module"
}

The option -no-bin-links does not work, it only effects node_modules/bin It creates a symlink and does not install the node_modules. 选项-no-bin-links不起作用,它仅影响node_modules/bin它创建一个符号链接,并且不安装node_modules。 I would like to do one of two things, not use the symlink and install node_modules, or use the symlink and install the modules. 我想做两件事之一,不要使用symlink并安装node_modules,或者使用symlink并安装模块。 Ideally combined with peerDependencies when using no symlinks. 不使用符号链接时,最好与peerDependencies结合使用。

npm current cannot install directly from a folder without a symlink. 如果没有符号链接, npm current无法直接从文件夹安装。

You can get around this by generating a tarball from the folder with npm pack , run from the directory of the package you want to install, followed by npm install <tarball> , where <tarball> is the path to your tarball of the package. 您可以通过以下方法解决此问题:在带有npm pack的文件夹中生成一个tarball,从要安装的软件包的目录运行,然后是npm install <tarball> ,其中<tarball>是该软件包的tarball的路径。

如果文件夹包含package.json文件描述的程序,则可以安装npm install <folder>npm install --save/--save-dev <folder>来更新相关的package.json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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