You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: www/apps/cloud/app/deployments/troubleshooting/page.mdx
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,6 +267,21 @@ If your storefront build fails with a `build-failed` status but the build logs a
267
267
- An outdated lockfile that is out of sync with `package.json`
268
268
- Incompatible or missing dependencies in the monorepo
269
269
270
+
### Check for Storefront Root Directory Misconfiguration
271
+
272
+
If the storefront build fails immediately (within 1-2 seconds) with no build logs and you see file retrieval errors, the storefront root directory configured in your Cloud project may not match the actual location of your storefront in the repository.
273
+
274
+
To verify and fix the storefront root directory:
275
+
276
+
1. In the [Cloud dashboard](../../organizations/page.mdx), open your project and go to **Settings**.
277
+
2. Check the **Storefront root directory** field and confirm it matches the actual path of your storefront in the repository. For example, if your storefront is at `apps/storefront`, the field should contain `apps/storefront`.
278
+
3. If the path is incorrect, update it and save.
279
+
4. Trigger a new deployment.
280
+
281
+
Refer to the [Projects](../../projects/page.mdx) guide for details on editing the storefront root directory setting.
282
+
283
+
---
284
+
270
285
### Check for Lockfile Mismatches
271
286
272
287
Cloud installs dependencies with a frozen lockfile to ensure reproducible builds. If your lockfile is out of sync with `package.json`, the dependency installation step may fail silently.
@@ -478,6 +493,38 @@ This is because Cloud does not currently support Node.js middlewares in Next.js
478
493
479
494
---
480
495
496
+
## Next.js Turbopack Workspace Root Error in Monorepos
497
+
498
+
If your Next.js 16+ storefront build fails with the following error:
499
+
500
+
```bash
501
+
Error: Next.js inferred your workspace root, but it may not be correct.
502
+
We couldn't find the Next.js package (next/package.json) from the project directory
503
+
```
504
+
505
+
This occurs in monorepo setups where the storefront is in a subdirectory (for example, `/storefront`) but `node_modules` is installed at the monorepo root. Turbopack's default workspace inference looks for`next/package.json` relative to the storefront directory, but the package is installed at the monorepo root.
506
+
507
+
### Fix Turbopack Workspace Root
508
+
509
+
Set the `turbopack.root` option in your `next.config.ts` to point to the monorepo root:
510
+
511
+
```ts title="apps/storefront/next.config.ts"
512
+
import path from "path"
513
+
import type { NextConfig } from "next"
514
+
515
+
const nextConfig: NextConfig = {
516
+
turbopack: {
517
+
root: path.join(__dirname, ".."),
518
+
},
519
+
}
520
+
521
+
export default nextConfig
522
+
```
523
+
524
+
Replace `".."` with the relative path from your storefront directory to the monorepo root. Commit the updated `next.config.ts` and push to trigger a new deployment.
Copy file name to clipboardExpand all lines: www/apps/cloud/app/projects/prerequisites/page.mdx
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
import { Note } from"docs-ui"
2
+
1
3
exportconst metadata = {
2
4
title: `Prerequisites for New Projects`,
3
5
}
@@ -121,6 +123,20 @@ Medusa uses Node.js v24.x (LTS) to build storefronts. You can't override this ve
121
123
122
124
So, ensure that your storefront is compatible with Node.js v24.x.
123
125
126
+
<Notetype="warning">
127
+
128
+
If your storefront's `package.json` has an `engines.node` field that restricts the Node.js version to a range that excludes v24.x (for example, `"22.x"`), the build will fail with a version incompatibility error. Update the field to accept v24.x, for example:
129
+
130
+
```json title="apps/storefront/package.json"
131
+
{
132
+
"engines": {
133
+
"node": ">=22.0.0"
134
+
}
135
+
}
136
+
```
137
+
138
+
</Note>
139
+
124
140
### Root Build Script
125
141
126
142
Your monorepo must have a `build` script that builds both the Medusa application and the storefront. Medusa executes this script during the deployment process.
0 commit comments