Search code examples
node.jsyarnpkgnpxyarnpkg-v2

yarn 3 install provides empty node_modules + npx scripts failures


I'm migrating my node repositories to yarn berry (v3) from yarn 1. So had a basic old school package.json and yarn.lock. And only a .yarnrc file to host npmjs token at user home folder. Nothing complicated.

Everything works well with all deps and devDeps on github actions, on my previous computer (yarn v1), on my intern computer (yarn v1 too), ...

When running yarn v3 for first time, told me that it migrates everything automatically to the new way (great news!).

So done a basic yarn install and seems that goes well enter image description here

yarn.lock file is updated to new style with all deps

But now node_modules is empty. There are some npx scripts which are not able to run because node_modules is still empty (even if running with yarn instead of npx).

Here is my yarnrc.yml file

defaultSemverRangePrefix: ""

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
    spec: "@yarnpkg/plugin-interactive-tools"

First lines of yarn.lock

enter image description here

What i'm doing wrong ?


Solution

  • Adding this to my .yarnrc.yml file

    nmMode: classic
    nodeLinker: node-modules
    

    Solved the problem. Yarn 3 berry put all modules into .yarn/cache folder instead of node_modules old school way. I need to still use this folder.