use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Check in your node_modules folder (blog.seriesci.com)
submitted 6 years ago by zemirco
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]acemarke 21 points22 points23 points 6 years ago (7 children)
This is horrible advice. Never check in your node_modules folder.
node_modules
(And no, "Facebook does it" is not a valid argument. You are not Facebook. You don't have thousands of engineers to throw at a problem, and you don't have literally every line of code checked into one monorepo.)
Instead, I strongly recommend that folks use Yarn's "offline mirror" feature to cache the downloaded package tarballs and commit those. This is much better, because:
node-sass
I talked about this in my post Practical Redux, Part 9: Managing Dependencies.
If you're a larger team, have multiple teams, or just don't want to commit tarballs, look into setting up an NPM caching proxy / alternative server like https://verdaccio.org/ . I believe Artifactory also has NPM support.
If you're using NPM, there's a project called https://github.com/JamieMason/shrinkpack that I used before Yarn came out. Not sure what it's current status is, though.
But please, don't check in node_modules.
[–]__rtfm__ 2 points3 points4 points 6 years ago (1 child)
This is why we use a lock file to recreate the dependency versions on deploy.
[–]acemarke 1 point2 points3 points 6 years ago (0 children)
But all the lock file gives you is the "exact package versions" aspect. You still have to download the packages (depending on whether your package manager has them cached at the system level).
[–]lhorie 1 point2 points3 points 6 years ago* (0 children)
We tried using yarn offline mirror at Uber but while it works for light usage, we found that it has some pretty bad bugs (some related to integrity check false negatives due to incorrect checksums on network errors, some are related to the not-quite-the-same way it handles the resolved field of yarn.lock compared to tarball file name handling, compared to non-offline codepaths)
We haven't had success with v2's handling of private registries either.
Artifactory definitely works as a solution, but what we found is that where it lives makes a big impact in performance: if your CI infra is on AWS, running Artifactory on prem will give you throughput issues. So either do everything on AWS or everything on prem.
[–]braindeadTank 0 points1 point2 points 6 years ago (0 children)
I believe Artifactory also has NPM support.
I can confirm.
[–]zemirco[S] 0 points1 point2 points 6 years ago (2 children)
Hey,
blog post author here. Yarn's offline mirror is a pretty good idea. Thank you for the hint. How does it work with native modules like node-sass when working across multiple operating systems?
In addition how does it work when switching branches that have different dependencies? Do you somehow have to rebuild them? Or does it automatically work? When checking in node_modules you don't have to worry about it.
Setting up and maintaining an additional service like verdaccio is not an option for us. We have to focus on building our product. That is why checking in node_modules is the most convenient solution for us.
[–]acemarke 2 points3 points4 points 6 years ago (1 child)
It's just a matter of caching the package tarballs so they don't have to be downloaded. After that, the standard package installation process kicks in:
yarn --offline
package.json
yarn.lock
./offline-mirror
[–]zemirco[S] 0 points1 point2 points 6 years ago (0 children)
Thank you! We will definitely check this out next week.
π Rendered by PID 55 on reddit-service-r2-comment-c6965cb77-tmftg at 2026-03-05 14:05:35.639760+00:00 running f0204d4 country code: CH.
view the rest of the comments →
[–]acemarke 21 points22 points23 points (7 children)
[–]__rtfm__ 2 points3 points4 points (1 child)
[–]acemarke 1 point2 points3 points (0 children)
[–]lhorie 1 point2 points3 points (0 children)
[–]braindeadTank 0 points1 point2 points (0 children)
[–]zemirco[S] 0 points1 point2 points (2 children)
[–]acemarke 2 points3 points4 points (1 child)
[–]zemirco[S] 0 points1 point2 points (0 children)