DEV Community

Lem Dulfo
Lem Dulfo

Posted on

1

Solved: npm or yarn install node_modules is too big

TLDR: It might be your node_modules hoisting limit configuration. Run yarn config get nmHoistingLimits

Background Context:

A colleague's local environment was generating a different licenses.txt file than what our CI system was generating, so his pull requests kept failing in CI.

licenses.txt is important when releasing a React Native app to the public, like Apple App Store or Google Play Store, especially when including MIT-licensed packages. Otherwise, your company might be held liable for improper attribution.

meme saying no to driver's license, yes to MIT license

Process of elimination, we compared our environments:

  • same: license-checker npm package
  • same: yarn.lock
  • same: nodenv, node, and yarn versions
  • same: .yarnrc
  • different: yarn install speed
  • different: string searching node_modules for one arbitrary library @babel/code-frame library yielded 100 results for me, and 400+ for him

It didn't initially make sense that the same package.json would behave differently, when our node and yarn were the same versions, and even our .yarnrc

Not knowing how to proceed, I described my problem to Chat GPT and it gave me this command to try:

yarn config list
Enter fullscreen mode Exit fullscreen mode

We ran this and found out that my config had this, and his did not:

nmHoistingLimits: 'workspaces'
Enter fullscreen mode Exit fullscreen mode

Hope this helps!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay