简体   繁体   English

VCS是否应跟踪node_modules目录?

[英]Should the node_modules directory be tracked by a VCS?

I just discovered the power of Grunt and have a very basic question. 我刚刚发现了Grunt的功能,并且有一个非常基本的问题。 Grunt creates a directory named node_modules as well as the package.json and the Gruntfile.js files. Grunt创建一个名为node_modules的目录以及package.jsonGruntfile.js文件。 When I look at Git repositories of other projects , I see that Gruntfile.js and package.json files have been committed, but the node_module directory is not. 当我查看其他项目的Git存储库时 ,我看到已经提交了Gruntfile.jspackage.json文件,但没有提交node_module目录。 Why? 为什么?

What is the best practice concerning the node_modules directory and the other two files? 关于node_modules目录和其他两个文件的最佳实践是什么?

You must run npm install on production and ignore node_modules in you repository. 您必须在生产环境中运行npm install并忽略存储库中的node_modules

node_modules can contain compiled native modules for you platform and server platform can be different, for example. node_modules可以包含针对您平台的已编译本机模块,而服务器平台可以不同。

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

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