Installation Problem: Cannot find module Yarn-Berry

C:\Windows\system32>yarn -v
internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module 'C:\Users\eudes\.yarn\releases\yarn-berry.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Author: Fantashit

2 thoughts on “Installation Problem: Cannot find module Yarn-Berry

  1. A guide on what files are actually needed to be able to run yarn 2 on a per-project basis would be nice. There’s absolutely no mention of that in the current docs. Also, pushing .yarn/cache to the repository, a directory with literally thousands of files, seems like an overkill to me.

  2. I added the following to my .gitignore. It ignores the .yarn directory, but adds exceptions for the plugins and releases subdirectory, which appear to be required in order to resolve plugins and the actual yarn client. It also looks like the sdk dir may need to be excluded based on your needs as well.

    /.yarn/*
    !/.yarn/plugins
    !/.yarn/releases
    

    I also found that you need to have your yarnPath set in your .yarnrc.yml. I’m not sure how it ended up not being set for me, but I did.

    yarnPath: .yarn/releases/yarn-2.2.2.cjs
    
    plugins:
      - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
        spec: "@yarnpkg/plugin-typescript"
    

Comments are closed.