Skip to content

Error: Cannot find module ' home [username] .yarn releases yarn berry.cjs'

Nicholas Nelson edited this page Jul 19, 2021 · 1 revision

Yarn recently upgraded to a per-project configuration model (see migration guide), and some errors have been observed while working with Synectic during this migration.

Yarn can be installed via npm, but in the case of MacOS users it is sometimes necessary to install using the alternative methods (e.g. curl commands). The following error is a very common issue that crops up after trying both of these methods:

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module '/home/nelsonni/.yarn/releases/yarn-berry.cjs'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:747:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

The solution to this problem is to delete the following, if they exist (per comments in yarnpkg/yarn#8460):

  • ~/.yarnrc
  • ~/.yarnrc.yml