Search code examples
yarnpkg

Yarn packages not found


I have Yarn 2.4.0
I used yarn add @mikro-orm/core to install the package.

package.json

{
  "name": "test",
  "dependencies": {
    "@mikro-orm/core": "^4.3.2"
  }
}

When I try to do something like:

const mikroORM = require("@mikro-orm/core");

const orm = mikroORM.MikroORM.init();

I get an error pointing to the import statement with:

code: 'MODULE_NOT_FOUND',

This happens with other packages as well.
What might be the problem here?


Solution

  • Run yarn to install the node_modules specified in the package.json.