yarnpkg-v2

.pnp.cjs gets deleted when running yarn install


We have a project running with yarn PnP and things were running smoothly.

In my local machine, however, I must have done something wrong because now whenever I run "yarn install" the .pnp.cjs file and .pnp.loader.mjs are getting deleted.


Solution

  • I ran into the same issue. I had somehow created a package.json and yarn.lock files in the parent directory from my project. Yarn was trying to use that instead of the project's files.

    Deleting those files cleared up the issue. You should also check your home directory for rogue yarn files.