I'm trying to deploy our homepage repo (apps/nd-web-home) to Vercel.
- Locally: the build works fine.
- On Vercel: the deploy fails with Module not found: Can't resolve '@repo/ui'.
Our setup:
/packages/ui→ shared component repo (@repo/ui) used across apps./apps/nd-web-home→ homepage app that imports from@repo/ui.
My Vercel build command looks like this:
"export:dev:homepage:vercel": "yarn turbo run build --scope=@repo/ui --include-dependencies --no-deps && turbo run export export:dev --scope=nd-web-home --include-dependencies --no-deps"
When Vercel runs the build, @repo/ui is built successfully (using tsup) and outputs to dist/.
But when Next.js builds nd-web-home, it fails to resolve @repo/ui.
Here's the relevant part of the Vercel error log:
16:21:45.863 nd-web-home:export:dev: Failed to compile.
./src/components/app/brands/brands-profile-page.tsx
Module not found: Can't resolve '@repo/ui'
./src/components/app/profilepage/profile-page.tsx
Module not found: Can't resolve '@repo/ui'
./src/components/homepage/components/landing/landing.tsx
Module not found: Can't resolve '@repo/ui'
./src/components/shared/contact-us-section.tsx
Module not found: Can't resolve '@repo/ui'
./src/layouts/homepage-layout/nav/MobileProfileMenu.tsx
Module not found: Can't resolve '@repo/ui'
Build failed because of webpack errors
Log shows @repo/ui builds fine with cache hit + successful tsup output, but Next.js still cannot resolve the package during the homepage build.
Full log
17:53:16.743 Running build in Washington, D.C., USA (East) – iad1
17:53:16.744 Build machine configuration: 2 cores, 8 GB
17:53:16.758 Cloning gitlab.com/rohilpinto/test-nd-web-mono-2 (Branch: dev, Commit: 94edbc4)
17:53:16.898 Previous build caches not available
17:53:18.828 Cloning completed: 2.070s
17:53:19.969 Running "vercel build"
17:53:20.404 Vercel CLI 48.1.6
17:53:20.572 > Detected Turbo. Adjusting default settings...
17:53:20.811 Warning: Detected "engines": { "node": ">=20.0.0" } in your `package.json` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version
17:53:20.825 Running "install" command: `yarn install`...
17:53:21.204 yarn install v1.22.19
17:53:21.361 [1/5] Validating package.json...
17:53:21.369 [2/5] Resolving packages...
17:53:22.240 [3/5] Fetching packages...
17:54:27.427 warning [email protected]: The engine "libvips" appears to be invalid.
17:54:27.432 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.432 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.436 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.436 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.436 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.436 warning @img/[email protected]: The engine "macos" appears to be invalid.
17:54:27.437 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.437 warning @img/[email protected]: The engine "macos" appears to be invalid.
17:54:27.437 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.437 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.438 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.438 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.438 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.438 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "musl" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.439 warning @img/[email protected]: The engine "musl" appears to be invalid.
17:54:27.440 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.440 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.440 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.440 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.440 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.441 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.441 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.444 warning @img/[email protected]: The engine "glibc" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "musl" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "musl" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.445 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.446 warning @img/[email protected]: The engine "pnpm" appears to be invalid.
17:54:27.446 warning [email protected]: The engine "bun" appears to be invalid.
17:54:27.447 warning [email protected]: The engine "deno" appears to be invalid.
17:54:27.449 warning @ecies/[email protected]: The engine "bun" appears to be invalid.
17:54:27.449 warning @ecies/[email protected]: The engine "deno" appears to be invalid.
17:54:27.463 [4/5] Linking dependencies...
17:54:27.464 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @wavesurfer/[email protected]" has incorrect peer dependency "react@^19.0.0".
17:54:27.465 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @wavesurfer/[email protected]" has incorrect peer dependency "wavesurfer.js@>=7.8.11".
17:54:27.483 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has unmet peer dependency "mapbox-gl@*".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has unmet peer dependency "redux@>4.0.0".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has unmet peer dependency "jquery@>=1.8.0".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has incorrect peer dependency "@types/react@^17.0.37".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has incorrect peer dependency "@types/react-dom@^17.0.11".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has incorrect peer dependency "react@^17.0.2".
17:54:27.484 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > [email protected]" has incorrect peer dependency "react-dom@^17.0.2".
17:54:27.485 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > @repo/ui > [email protected]" has unmet peer dependency "esbuild@^0.19.1".
17:54:27.485 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @sentry/nextjs > @sentry/[email protected]" has unmet peer dependency "@opentelemetry/context-async-hooks@^1.30.1".
17:54:27.485 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @sentry/nextjs > @sentry/[email protected]" has unmet peer dependency "@opentelemetry/core@^1.30.1".
17:54:27.485 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @sentry/nextjs > @sentry/[email protected]" has unmet peer dependency "@opentelemetry/instrumentation@^0.57.1".
17:54:27.485 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @sentry/nextjs > @sentry/[email protected]" has unmet peer dependency "@opentelemetry/sdk-trace-base@^1.30.1".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @sentry/nextjs > @sentry/[email protected]" has unmet peer dependency "webpack@>=4.40.0".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @types/react-leaflet > [email protected]" has incorrect peer dependency "react@^19.0.0".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @types/react-leaflet > [email protected]" has incorrect peer dependency "react-dom@^19.0.0".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > notistack > [email protected]" has unmet peer dependency "csstype@^3.0.10".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > @repo/eslint-config > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=4.2.0".
17:54:27.486 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @types/react-leaflet > react-leaflet > @react-leaflet/[email protected]" has incorrect peer dependency "react@^19.0.0".
17:54:27.487 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > @types/react-leaflet > react-leaflet > @react-leaflet/[email protected]" has incorrect peer dependency "react-dom@^19.0.0".
17:54:27.487 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > aws-amplify > @aws-amplify/core > [email protected]" has unmet peer dependency "react-native@*".
17:54:27.487 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-home > ts-migrate > ts-migrate-plugins > [email protected]" has unmet peer dependency "@babel/preset-env@^7.1.6".
17:54:27.487 warning "workspace-aggregator-ed4f7b86-1416-4f05-b9ed-53e7a5450cc2 > nd-web-dashboard > aws-amplify > @aws-amplify/analytics > @aws-sdk/client-firehose > @aws-sdk/middleware-retry > [email protected]" has unmet peer dependency "react-native@>=0.56".
17:55:15.818 [5/5] Building fresh packages...
17:55:18.128 success Saved lockfile.
17:55:18.133 Done in 116.93s.
17:55:18.178 Detected Next.js version: 15.1.2
17:55:18.178 Running "cd ../.. && yarn export:dev:homepage:vercel"
17:55:18.351 yarn run v1.22.19
17:55:18.378 $ yarn turbo run build --scope=@repo/ui --include-dependencies && turbo run export export:dev --scope=nd-web-home --include-dependencies
17:55:18.569 $ /vercel/path0/node_modules/.bin/turbo run build --scope=@repo/ui --include-dependencies
17:55:18.970
17:55:18.970 Attention:
17:55:18.971 Turborepo now collects completely anonymous telemetry regarding usage.
17:55:18.971 This information is used to shape the Turborepo roadmap and prioritize features.
17:55:18.971 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
17:55:18.971 https://turbo.build/repo/docs/telemetry
17:55:18.971
17:55:19.437 • Packages in scope: @repo/eslint-config, @repo/i18n, @repo/types, @repo/typescript-config, @repo/ui, @repo/utils, namedrop-otu-page, nd-web-dashboard, nd-web-home
17:55:19.438 • Running build in 9 packages
17:55:19.438 • Remote caching enabled
17:55:19.644 @repo/ui:build: cache hit, replaying logs c12eccef47e2a291
17:55:19.644 @repo/ui:build: $ tsup src/index.ts --format esm,cjs --dts --external react
17:55:19.644 @repo/ui:build: CLI Building entry: src/index.ts
17:55:19.644 @repo/ui:build: CLI Using tsconfig: tsconfig.json
17:55:19.644 @repo/ui:build: CLI tsup v8.0.2
17:55:19.645 @repo/ui:build: CLI Using tsup config: /vercel/path0/packages/ui/tsup.config.ts
17:55:19.645 @repo/ui:build: CLI Target: es2020
17:55:19.645 @repo/ui:build: ESM Build start
17:55:19.645 @repo/ui:build: CJS Build start
17:55:19.645 @repo/ui:build: DTS Build start
17:55:19.645 @repo/ui:build: CJS dist/index.cjs 685.06 KB
17:55:19.645 @repo/ui:build: CJS ⚡️ Build success in 1417ms
17:55:19.646 @repo/ui:build: ESM dist/features-KK6UOLRJ.js 195.00 B
17:55:19.646 @repo/ui:build: ESM dist/chunk-BFJSFT3N.js 1.34 KB
17:55:19.646 @repo/ui:build: ESM dist/index.js 649.89 KB
17:55:19.646 @repo/ui:build: ESM ⚡️ Build success in 1421ms
17:55:19.646 @repo/ui:build: DTS ⚡️ Build success in 16422ms
17:55:19.646 @repo/ui:build: DTS dist/index.d.ts 71.87 KB
17:55:19.647 @repo/ui:build: DTS dist/index.d.cts 71.87 KB
17:55:19.742 nd-web-home:build: cache miss, executing 3b3855703544838c
17:55:19.930 nd-web-home:build: $ next build
17:55:20.491 nd-web-home:build: DASHBOARD_LOGIN_URL http://localhost:3000/login
17:55:20.555 nd-web-home:build: Attention: Next.js now collects completely anonymous telemetry regarding usage.
17:55:20.556 nd-web-home:build: This information is used to shape Next.js' roadmap and prioritize features.
17:55:20.556 nd-web-home:build: You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
17:55:20.556 nd-web-home:build: https://nextjs.org/telemetry
17:55:20.556 nd-web-home:build:
17:55:20.616 nd-web-home:build: ▲ Next.js 15.1.2
17:55:20.616 nd-web-home:build: - Environments: .env.local, .env.production
17:55:20.616 nd-web-home:build:
17:55:20.688 nd-web-home:build: Creating an optimized production build ...
17:55:45.986 nd-web-home:build: Failed to compile.
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: ./src/components/app/brands/brands-profile-page.tsx
17:55:45.987 nd-web-home:build: Module not found: Can't resolve '@repo/ui'
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: https://nextjs.org/docs/messages/module-not-found
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: ./src/components/app/profilepage/profile-page.tsx
17:55:45.987 nd-web-home:build: Module not found: Can't resolve '@repo/ui'
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: https://nextjs.org/docs/messages/module-not-found
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: ./src/components/homepage/components/landing/landing.tsx
17:55:45.987 nd-web-home:build: Module not found: Can't resolve '@repo/ui'
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: https://nextjs.org/docs/messages/module-not-found
17:55:45.987 nd-web-home:build:
17:55:45.987 nd-web-home:build: Import trace for requested module:
17:55:45.987 nd-web-home:build: ./src/components/homepage/components/landing/index.ts
17:55:45.988 nd-web-home:build: ./src/components/homepage/components/index.ts
17:55:45.988 nd-web-home:build: ./src/components/app/homepage/homepage.tsx
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: ./src/components/shared/contact-us-section.tsx
17:55:45.988 nd-web-home:build: Module not found: Can't resolve '@repo/ui'
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: https://nextjs.org/docs/messages/module-not-found
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: Import trace for requested module:
17:55:45.988 nd-web-home:build: ./src/components/app/offerings-otu/offerings-otu.tsx
17:55:45.988 nd-web-home:build: ./src/app/(homepage)/offerings-otu/page.tsx
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: ./src/layouts/homepage-layout/nav/MobileProfileMenu.tsx
17:55:45.988 nd-web-home:build: Module not found: Can't resolve '@repo/ui'
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: https://nextjs.org/docs/messages/module-not-found
17:55:45.988 nd-web-home:build:
17:55:45.988 nd-web-home:build: Import trace for requested module:
17:55:45.989 nd-web-home:build: ./src/layouts/homepage-layout/nav/NavVertical.tsx
17:55:45.989 nd-web-home:build: ./src/layouts/homepage-layout/Header.tsx
17:55:45.989 nd-web-home:build: ./src/layouts/homepage-layout/HomepageLayout.tsx
17:55:45.989 nd-web-home:build:
17:55:45.989 nd-web-home:build:
17:55:45.989 nd-web-home:build: > Build failed because of webpack errors
17:55:46.045 nd-web-home:build: error Command failed with exit code 1.
17:55:46.046 nd-web-home:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
17:55:46.094 nd-web-home:build: ERROR: command finished with error: command (/vercel/path0/apps/nd-web-home-next.js) /tmp/yarn--1758889518572-0.9919240261398161/yarn run build exited (1)
17:55:46.095 nd-web-home#build: command (/vercel/path0/apps/nd-web-home-next.js) /tmp/yarn--1758889518572-0.9919240261398161/yarn run build exited (1)
17:55:46.193
17:55:46.194 Tasks: 1 successful, 2 total
17:55:46.194 Cached: 1 cached, 2 total
17:55:46.194 Time: 27.119s
17:55:46.194 Summary: /vercel/path0/.turbo/runs/33EkJRiA61f3pfdVLOFWwEKrK43.json
17:55:46.194 Failed: nd-web-home#build
17:55:46.194
17:55:46.203 ERROR run failed: command exited (1)
17:55:46.267 error Command failed with exit code 1.
17:55:46.267 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
17:55:46.451 error Command failed with exit code 1.
17:55:46.452 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
17:55:46.469 Error: Command "cd ../.. && yarn export:dev:homepage:vercel" exited with 1