Package.json file
{
"name": "backend",
"version": "0.0.1",
"description": "A starter for Medusa projects.",
"author": "Medusa (https://medusajs.com)",
"license": "MIT",
"keywords": [
"sqlite",
"postgres",
"typescript",
"ecommerce",
"headless",
"medusa"
],
"scripts": {
"build": "medusa build",
"seed": "medusa exec ./src/scripts/seed.ts",
"start": "medusa start",
"dev": "medusa develop",
"test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
"test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
"test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
},
"dependencies": {
"@ladjs/consolidate": "^1.0.4",
"@medusajs/admin-sdk": "2.9.0",
"@medusajs/cli": "2.9.0",
"@medusajs/event-bus-local": "^2.9.0",
"@medusajs/event-bus-redis": "^2.9.0",
"@medusajs/framework": "2.9.0",
"@medusajs/medusa": "^2.9.0",
"@mikro-orm/core": "6.4.3",
"@mikro-orm/knex": "6.4.3",
"@mikro-orm/migrations": "6.4.3",
"@mikro-orm/postgresql": "6.4.3",
"@react-email/components": "0.5.1",
"awilix": "^8.0.1",
"ejs": "^3.1.10",
"email-templates": "^12.0.3",
"medusa-plugin-smtp": "^1.2.0",
"multer": "^2.0.2",
"nodemailer": "^7.0.5",
"pg": "^8.13.0",
"resend": "^6.0.1",
"zod": "^3.25.76"
},
"devDependencies": {
"@medusajs/medusa-oas-cli": "^2.9.0",
"@medusajs/test-utils": "2.9.0",
"@mikro-orm/cli": "6.4.3",
"@swc/core": "1.5.7",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13",
"@types/multer": "^2.0.0",
"@types/node": "^20.0.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"jest": "^29.7.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.2.11",
"yalc": "^1.0.0-pre.53"
},
"engines": {
"node": ">=20"
}
}
Node.js version
v22.21.1
Database and its version
18.1-1.pgdg13+2
Operating system name and version
MacOs 26.4
Browser name
No response
What happended?
After setting up an old MedusaJS project on a new device and reinstalling dependencies, the app fails to run with the following error:
Error: Package subpath './awilix' is not defined by "exports" in node_modules/@medusajs/framework/package.json
This error occurs when running:
yarn dev
yarn build
yarn start
Additional context
-
I checked Medusa documentation and found that from v2.11.0 onwards, imports like:
import { ... } from "@mikro-orm/core"
should be replaced with:
import { ... } from "@medusajs/framework/mikro-orm/core"
-
I ran the official migration script to update imports. It updated some files in my codebase.
-
However, the error persists because the problematic import appears to originate from inside node_modules, not my source code.
Environment
- Node.js: >=20
- Medusa CLI version: 2.9.0
- Medusa version: 2.13.5
- Package manager: yarn
Possible cause
It seems like there may be:
- A mismatch between
@medusajs/framework exports and internal usage of awilix, or
- A dependency expecting an older export structure (
@medusajs/framework/awilix) that is no longer exposed.
Workarounds tried
#13807 (comment)
It didn't resolve the issue.
Expected behavior
The project should start normally without module resolution errors.
Actual behavior
Node throws an error related to subpath exports:
Error: Package subpath './awilix' is not defined by "exports"
Link to reproduction repo
https://github.com/Prashantch265/medusajs-backend
Package.json file
{ "name": "backend", "version": "0.0.1", "description": "A starter for Medusa projects.", "author": "Medusa (https://medusajs.com)", "license": "MIT", "keywords": [ "sqlite", "postgres", "typescript", "ecommerce", "headless", "medusa" ], "scripts": { "build": "medusa build", "seed": "medusa exec ./src/scripts/seed.ts", "start": "medusa start", "dev": "medusa develop", "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit", "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit", "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit" }, "dependencies": { "@ladjs/consolidate": "^1.0.4", "@medusajs/admin-sdk": "2.9.0", "@medusajs/cli": "2.9.0", "@medusajs/event-bus-local": "^2.9.0", "@medusajs/event-bus-redis": "^2.9.0", "@medusajs/framework": "2.9.0", "@medusajs/medusa": "^2.9.0", "@mikro-orm/core": "6.4.3", "@mikro-orm/knex": "6.4.3", "@mikro-orm/migrations": "6.4.3", "@mikro-orm/postgresql": "6.4.3", "@react-email/components": "0.5.1", "awilix": "^8.0.1", "ejs": "^3.1.10", "email-templates": "^12.0.3", "medusa-plugin-smtp": "^1.2.0", "multer": "^2.0.2", "nodemailer": "^7.0.5", "pg": "^8.13.0", "resend": "^6.0.1", "zod": "^3.25.76" }, "devDependencies": { "@medusajs/medusa-oas-cli": "^2.9.0", "@medusajs/test-utils": "2.9.0", "@mikro-orm/cli": "6.4.3", "@swc/core": "1.5.7", "@swc/jest": "^0.2.36", "@types/jest": "^29.5.13", "@types/multer": "^2.0.0", "@types/node": "^20.0.0", "@types/react": "^18.3.2", "@types/react-dom": "^18.2.25", "jest": "^29.7.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "ts-node": "^10.9.2", "typescript": "^5.6.2", "vite": "^5.2.11", "yalc": "^1.0.0-pre.53" }, "engines": { "node": ">=20" } }Node.js version
v22.21.1
Database and its version
18.1-1.pgdg13+2
Operating system name and version
MacOs 26.4
Browser name
No response
What happended?
After setting up an old MedusaJS project on a new device and reinstalling dependencies, the app fails to run with the following error:
This error occurs when running:
yarn devyarn buildyarn startAdditional context
I checked Medusa documentation and found that from v2.11.0 onwards, imports like:
should be replaced with:
I ran the official migration script to update imports. It updated some files in my codebase.
However, the error persists because the problematic import appears to originate from inside
node_modules, not my source code.Environment
Possible cause
It seems like there may be:
@medusajs/frameworkexports and internal usage ofawilix, or@medusajs/framework/awilix) that is no longer exposed.Workarounds tried
#13807 (comment)
It didn't resolve the issue.
Expected behavior
The project should start normally without module resolution errors.
Actual behavior
Node throws an error related to subpath exports:
Link to reproduction repo
https://github.com/Prashantch265/medusajs-backend