-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
Package.json file
{
"name": "medusa-starter-default",
"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": {
"@medusajs/admin-sdk": "2.13.1",
"@medusajs/admin-shared": "^2.13.1",
"@medusajs/cli": "2.13.1",
"@medusajs/dashboard": "^2.13.1",
"@medusajs/draft-order": "2.13.1",
"@medusajs/framework": "2.13.1",
"@medusajs/icons": "^2.13.3",
"@medusajs/medusa": "2.13.1",
"@medusajs/types": "^2.13.3",
"@medusajs/ui": "^4.1.3"
},
"devDependencies": {
"@medusajs/test-utils": "2.13.1",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"jest": "^29.7.0",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.14",
"yalc": "^1.0.0-pre.53"
},
"engines": {
"node": ">=20"
}
}Node.js version
v20.20.0
Database and its version
postgres 15-alpine
Operating system name and version
PopOs host, Docker Containers
Browser name
Vivaldi
What happended?
I've tried to setup Medusa.js, PostgreSql, redis, through a docker compose file.
I got everything setup and running. And it served the http://localhost:9000/app route.
But then i get a white page. And an error about a missing index.ts
8:39:46 AM [vite] Internal server error: Failed to resolve import "/src/admin/i18n/index.ts" from "virtual:medusa/i18n". Does the file exist?
medusa_backend | Plugin: vite:import-analysis
medusa_backend | File: virtual:medusa/i18n:2:32
medusa_backend | 1 | import { deepMerge } from "@medusajs/admin-shared"
medusa_backend | 2 | import i18nTranslations0 from "/app/src/admin/i18n/index.ts"
medusa_backend | | ^
medusa_backend | 3 |
medusa_backend | 4 | export default { resources: i18nTranslations0 }
medusa_backend | at TransformPluginContext._formatError
...
I've checked in the docker container. And the index.ts file exists.
/app # cat /app/src/admin/i18n/index.ts
import en from "./json/en.json" with { type: "json" }
export default {
en: {
translation: en,
},
So this seems to be a bug related to running Medusa.js in docker with pnpm?
My Docker file:
FROM node:20-alpine
# Install pnpm globally (small addition, ~10-20s extra on first build)
RUN npm install -g pnpm@latest
WORKDIR /app
# Copy lockfile + package.json first for caching
COPY package.json pnpm-lock.yaml* .npmrc* ./
# Install dependencies with pnpm (uses your pnpm-lock.yaml if it exists)
RUN pnpm install --frozen-lockfile
COPY . .
# Make sure start.sh is executable in container too (optional but safe)
RUN chmod +x start.sh
EXPOSE 9000 7001
CMD ["sh", "./start.sh"]
My medusa-config.ts
import { loadEnv, defineConfig } from '@medusajs/framework/utils'
loadEnv(process.env.NODE_ENV || 'development', process.cwd())
module.exports = defineConfig({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
http: {
storeCors: process.env.STORE_CORS!,
adminCors: process.env.ADMIN_CORS!,
authCors: process.env.AUTH_CORS!,
jwtSecret: process.env.JWT_SECRET || "supersecret",
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
},
databaseDriverOptions: {
ssl: false,
sslmode: "disable",
},
},
admin: {
// optional but recommended when running in Docker / separate origin
backendUrl: process.env.MEDUSA_BACKEND_URL || "http://localhost:9000",
vite: (config) => {
return {
...config,
server: {
host: "0.0.0.0",
allowedHosts: ["localhost", ".localhost", "127.0.0.1"],
hmr: {
port: 5173,
clientPort: 5173,
},
},
}
},
},
})
Expected behavior
Not a white page.
Not the import error in the backend.
Actual behavior
But then i get a white page. And an error about a missing index.ts
8:39:46 AM [vite] Internal server error: Failed to resolve import "/src/admin/i18n/index.ts" from "virtual:medusa/i18n". Does the file exist?
medusa_backend | Plugin: vite:import-analysis
medusa_backend | File: virtual:medusa/i18n:2:32
medusa_backend | 1 | import { deepMerge } from "@medusajs/admin-shared"
medusa_backend | 2 | import i18nTranslations0 from "/app/src/admin/i18n/index.ts"
medusa_backend | | ^
medusa_backend | 3 |
medusa_backend | 4 | export default { resources: i18nTranslations0 }
medusa_backend | at TransformPluginContext._formatError
...
Link to reproduction repo
Reactions are currently unavailable