I'm wondering if we should be tracking node_modules in our repo or doing an npm install when checking out the code?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- Failed at the electron@1.8.2 postinstall script
- How to reimport module with ES6 import
- Webpack getting started, import error
相关文章
- 请教Git如何克隆本地库?
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- What is the tortoisehg gui equivalent of doing “hg
- @angular-cli install fails with deprecated request
- How to use Mercurial from Visual Studio 2010?
- GitHub:Enterprise post-receive hook
- node.js modify file data stream?
Not tracking
node_modules
with source control is the right choice because some NodeJS modules, like MongoDB NodeJS driver, use NodeJS C++ add-ons. These add-ons are compiled when runningnpm install
command. So when you tracknode_modules
directory, you may accidentally commit an OS specific binary file.The answer is not as easy as Alberto Zaccagni suggests. If you develop applications (especially enterprise applications), including node_modules in your git repo is a viable choice and which alternative you choose depends on your project.
Because he argued very well against node_modules I will concentrate on arguments for them.
Imagine that you have just finished enterprise app and you will have to support it for 3-5 years. You definitely don't want to depend on someone's npm module which can tomorrow disappear and you can't update your app anymore.
Or you have your private modules which are not accessible from the internet and you can't build your app on the Internet. Or maybe you don't want to depend on your final build on npm service for some reasons.
You can find pros and cons in this Addy Osmani article (although it is about Bower, it is almost the same situation). And I will end with a quote from Bower homepage and Addy's article: