Checking in node_module was the community standard but now we also have an option to use shrinkwrap. The latter makes more sense to me but there is always the chance that someone did "force publish" and introduced a bug. Are there any additional drawbacks?
相关问题
- 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
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
My favorite post/philosophy on this subject goes all the way back (a long time in node.js land) to 2011:
https://web.archive.org/web/20150116024411/http://www.futurealoof.com/posts/nodemodules-in-git.html
To quote directly:
I think this is still the best advice.
The force-publish scenario is rare and
npm shrinkwrap
would probably work for most people. But if you're deploying to a production environment, nothing gives you the peace-of-mind like checking in the entirenode_modules
directory.Alternately, if you really, really don't want to check in the
node_modules
directory but want a better guarantee there hasn't been a forced push, I'd follow the advice innpm help shrinkwrap
:Of course, someone could run a weird
git rebase
or something and modify a git commit hash... but now we're just getting crazy.npm FAQ directly answers this:
cited from npm FAQ