[英]node_modules dir being included in module published to NPM registry
I published my module to the NPM registry. 我将模块发布到NPM注册中心。 When I installed it using
当我使用安装
npm install --save-dev X
I see that the node_modules folder was included in the install, such that when I go to project Y which depends on X, I see: 我看到安装中包含了node_modules文件夹,因此当我转到依赖X的项目Y时,我看到:
Y/node_modules/X/node_modules
How is this possible? 这怎么可能?
My .npmignore file in my X project is as follows: 我的X项目中的.npmignore文件如下:
.idea
node_modules
bower_components
internal-docs
Anyone know what could be up? 有人知道会发生什么吗?
You don't need to add node_modules
to your .npmignore
; 您不需要将
node_modules
添加到您的.npmignore
; it is ignored by default : 默认情况下将其忽略 :
Additionally, everything in
node_modules
is ignored, except for bundled dependencies.此外,
node_modules
所有内容都node_modules
被忽略,但捆绑的依赖项除外。 npm automatically handles this for you, so don't bother addingnode_modules
to.npmignore
.NPM自动为您处理此,所以也懒得添加
node_modules
到.npmignore
。
The npm install
command will naturally install the package's dependencies that are listed in its package.json
file. npm install
命令自然会安装在package.json
文件中列出的软件包依赖项。 It is a normal part of the npm install
process to install the whole dependencies tree, otherwise the package wouldn't really work. npm install
过程的正常部分是安装整个依赖关系树,否则该软件包将无法正常工作。
If you want to be really sure, you can use the npm pack
command to generate a tarball (similar to a zip file) that you can inspect and see what files are actually published when you run npm publish
. 如果确实需要确定,可以使用
npm pack
命令生成一个tarball(类似于zip文件),您可以检查它并查看在运行npm publish
时实际发布了哪些文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.