Header

Using Yarn 4 in the Build Pipeline

In order to be able to use Yarn 4 to build your node projects, you will need to first add this step:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source $HOME/.nvm/nvm.sh
nvm install 18;
nvm use 18;

corepack enable;
corepack prepare yarn@4.8.1 --activate;
yarn --version;

What's new in Yarn 4?

  • Enhanced Plug'n'Play (PnP): It heavily leverages PnP, reducing dependency size and speeding up installations.
  • Stronger Security: It includes features like "Hardened Mode" to protect against supply chain attacks.
  • Corepack Integration: It emphasizes Corepack for consistent package manager versions.
  • Improved Performance: It has performance optimizations, like a new package metadata cache.
  • Modernizing Yarn: Requires Node.js 18+ to leverage newer javaScript features.

Happy deploying!

Tree

Proudly powered by Katapult. Running on 100% renewable energy.