Back

要不要把node_module放到git中( do not put node_module into git)

发布时间: 2015-02-24 02:28:00

refer to:  http://stackoverflow.com/questions/11459475/should-i-check-in-node-modules-to-git-when-creating-a-node-js-app-on-heroku

答案是: 不要.

放个 package.json 就可以了. 

Usually, no. Allow npm to resolve dependencies for your packages. 

如果一定要放的话也可以,只是要修改 .gitignore: 

# Ignore native extensions in the node_modules folder (things changed by npm rebuild)
node_modules/**/*.node
node_modules/**/*.o
node_modules/**/*.a
node_modules/**/*.mk
node_modules/**/*.gypi
node_modules/**/*.target
node_modules/**/.deps/
node_modules/**/build/Makefile
node_modules/**/**/build/Makefile

这样的话,每次 $ npm rebuild  之后, $ git status 都不会发生变化. 

Back