Module not found: Can't resolve 'styled-components'
Opened this issue · 0 comments
Ricardomol commented
I'm working with the Pro version of the template. I just downloaded it, initialized a repo and tried deploying it to Vercel, but the deployment fails with the following error:
./node_modules/@sanity/portable-text-editor/lib/index.esm.js
Module not found: Can't resolve 'styled-components'
Here are the complete logs:
[16:24:14.268] Running build in Washington, D.C., USA (East) – iad1
[16:24:14.379] Cloning github.com/Ricardomol/my_private_repo (Branch: main, Commit: e8ea4f9)
[16:24:14.738] Previous build cache not available
[16:24:14.823] Cloning completed: 443.925ms
[16:24:15.106] Running "vercel build"
[16:24:15.551] Vercel CLI 37.1.2
[16:24:15.899] Installing dependencies...
[16:24:16.191] yarn install v1.22.19
[16:24:16.261] [1/4] Resolving packages...
[16:24:17.664] [2/4] Fetching packages...
[16:24:50.775] warning sharp@0.33.2: The engine "libvips" appears to be invalid.
[16:24:50.778] warning @img/sharp-darwin-x64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.780] warning @img/sharp-darwin-x64@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.781] warning @img/sharp-libvips-darwin-x64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.782] warning @img/sharp-libvips-darwin-x64@1.0.1: The engine "macos" appears to be invalid.
[16:24:50.782] warning @img/sharp-libvips-linux-s390x@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.782] warning @img/sharp-libvips-linux-s390x@1.0.1: The engine "glibc" appears to be invalid.
[16:24:50.782] warning @img/sharp-libvips-linuxmusl-x64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.782] warning @img/sharp-libvips-linuxmusl-x64@1.0.1: The engine "musl" appears to be invalid.
[16:24:50.782] warning @img/sharp-darwin-arm64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.783] warning @img/sharp-darwin-arm64@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-x64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-x64@1.0.1: The engine "glibc" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-arm@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-arm@1.0.1: The engine "glibc" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-darwin-arm64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-darwin-arm64@1.0.1: The engine "macos" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-arm64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.783] warning @img/sharp-libvips-linux-arm64@1.0.1: The engine "glibc" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-arm@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-arm@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.784] warning @img/sharp-libvips-linuxmusl-arm64@1.0.1: The engine "pnpm" appears to be invalid.
[16:24:50.784] warning @img/sharp-libvips-linuxmusl-arm64@1.0.1: The engine "musl" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-arm64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-arm64@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-s390x@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-s390x@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-x64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.784] warning @img/sharp-linux-x64@0.33.2: The engine "glibc" appears to be invalid.
[16:24:50.784] warning @img/sharp-linuxmusl-arm64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.785] warning @img/sharp-linuxmusl-arm64@0.33.2: The engine "musl" appears to be invalid.
[16:24:50.785] warning @img/sharp-win32-ia32@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.785] warning @img/sharp-wasm32@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.785] warning @img/sharp-linuxmusl-x64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.785] warning @img/sharp-linuxmusl-x64@0.33.2: The engine "musl" appears to be invalid.
[16:24:50.785] warning @img/sharp-win32-x64@0.33.2: The engine "pnpm" appears to be invalid.
[16:24:50.793] [3/4] Linking dependencies...
[16:24:50.797] warning " > next-sanity@8.0.0" has unmet peer dependency "@sanity/client@^6.12.4".
[16:24:50.797] warning " > next-sanity@8.0.0" has unmet peer dependency "@sanity/icons@^2.8".
[16:24:50.797] warning " > next-sanity@8.0.0" has unmet peer dependency "@sanity/types@^3.25".
[16:24:50.797] warning " > next-sanity@8.0.0" has unmet peer dependency "@sanity/ui@^1.8 || ^2.0.0-beta || ^2.0".
[16:24:50.797] warning " > next-sanity@8.0.0" has unmet peer dependency "styled-components@^5.2 || ^6.0".
[16:24:50.797] warning "react-hot-toast > goober@2.1.13" has unmet peer dependency "csstype@^3.0.10".
[16:24:50.798] warning " > sanity@3.29.1" has unmet peer dependency "styled-components@^5.2 || ^6".
[16:24:50.799] warning "sanity > @sanity/portable-text-editor@3.29.1" has unmet peer dependency "styled-components@^5.2 || ^6".
[16:24:50.799] warning "sanity > @sanity/ui@2.0.3" has unmet peer dependency "styled-components@^5.2 || ^6".
[16:24:50.826] warning Workspaces can only be enabled in private projects.
[16:24:50.834] warning Workspaces can only be enabled in private projects.
[16:24:50.840] warning Workspaces can only be enabled in private projects.
[16:24:50.841] warning Workspaces can only be enabled in private projects.
[16:24:50.841] warning Workspaces can only be enabled in private projects.
[16:24:50.841] warning Workspaces can only be enabled in private projects.
[16:25:01.305] [4/4] Building fresh packages...
[16:25:03.899] success Saved lockfile.
[16:25:03.904] Done in 47.72s.
[16:25:03.940] Detected Next.js version: 14.1.0
[16:25:03.941] Running "yarn run build"
[16:25:04.135] yarn run v1.22.19
[16:25:04.163] $ prisma generate && next build
[16:25:04.798] Prisma schema loaded from prisma/schema.prisma
[16:25:05.241]
[16:25:05.241] ✔ Generated Prisma Client (v5.9.1) to ./node_modules/@prisma/client in 61ms
[16:25:05.241]
[16:25:05.241] Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
[16:25:05.241] ```
[16:25:05.241] import { PrismaClient } from '@prisma/client'
[16:25:05.241] const prisma = new PrismaClient()
[16:25:05.242] ```
[16:25:05.242] or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
[16:25:05.242] ```
[16:25:05.242] import { PrismaClient } from '@prisma/client/edge'
[16:25:05.242] const prisma = new PrismaClient()
[16:25:05.242] ```
[16:25:05.242]
[16:25:05.242] See other ways of importing Prisma Client: http://pris.ly/d/importing-client
[16:25:05.242]
[16:25:05.242] ┌─────────────────────────────────────────────────────────────┐
[16:25:05.242] │ Deploying your app to serverless or edge functions? │
[16:25:05.242] │ Try Prisma Accelerate for connection pooling and caching. │
[16:25:05.242] │ https://pris.ly/cli/accelerate │
[16:25:05.242] └─────────────────────────────────────────────────────────────┘
[16:25:05.242]
[16:25:05.865] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[16:25:05.866] This information is used to shape Next.js' roadmap and prioritize features.
[16:25:05.866] 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:
[16:25:05.866] https://nextjs.org/telemetry
[16:25:05.866]
[16:25:05.963] ▲ Next.js 14.1.0
[16:25:05.964]
[16:25:06.044] Creating an optimized production build ...
[16:25:33.216] Failed to compile.
[16:25:33.216]
[16:25:33.216] ./node_modules/@sanity/portable-text-editor/lib/index.esm.js
[16:25:33.216] Module not found: Can't resolve 'styled-components'
[16:25:33.216]
[16:25:33.216] https://nextjs.org/docs/messages/module-not-found
[16:25:33.216]
[16:25:33.217] Import trace for requested module:
[16:25:33.217] ./node_modules/sanity/lib/index.esm.js
[16:25:33.217] ./sanity.config.ts
[16:25:33.217] ./src/app/(studio)/admin/[[...index]]/page.tsx
[16:25:33.217]
[16:25:33.217] ./node_modules/@sanity/ui/dist/index.esm.js
[16:25:33.217] Module not found: Can't resolve 'styled-components'
[16:25:33.217]
[16:25:33.217] https://nextjs.org/docs/messages/module-not-found
[16:25:33.217]
[16:25:33.217] Import trace for requested module:
[16:25:33.217] ./node_modules/sanity/lib/desk.esm.js
[16:25:33.217] ./sanity.config.ts
[16:25:33.217] ./src/app/(studio)/admin/[[...index]]/page.tsx
[16:25:33.217]
[16:25:33.217] ./node_modules/sanity/lib/_chunks/TooltipDelayGroupProvider-e1ApGn-p.js
[16:25:33.217] Module not found: Can't resolve 'styled-components'
[16:25:33.217]
[16:25:33.217] https://nextjs.org/docs/messages/module-not-found
[16:25:33.217]
[16:25:33.217] Import trace for requested module:
[16:25:33.217] ./node_modules/sanity/lib/desk.esm.js
[16:25:33.217] ./sanity.config.ts
[16:25:33.217] ./src/app/(studio)/admin/[[...index]]/page.tsx
[16:25:33.217]
[16:25:33.217] ./node_modules/sanity/lib/_chunks/_internalBrowser-g8TrRAj2.js
[16:25:33.217] Module not found: Can't resolve 'styled-components'
[16:25:33.217]
[16:25:33.217] https://nextjs.org/docs/messages/module-not-found
[16:25:33.217]
[16:25:33.217] Import trace for requested module:
[16:25:33.217] ./node_modules/sanity/lib/index.esm.js
[16:25:33.217] ./sanity.config.ts
[16:25:33.217] ./src/app/(studio)/admin/[[...index]]/page.tsx
[16:25:33.218]
[16:25:33.218] ./node_modules/sanity/lib/_chunks/index-c8Mnhnf1.js
[16:25:33.218] Module not found: Can't resolve 'styled-components'
[16:25:33.218]
[16:25:33.218] https://nextjs.org/docs/messages/module-not-found
[16:25:33.218]
[16:25:33.218] Import trace for requested module:
[16:25:33.218] ./node_modules/sanity/lib/_chunks/structure-pNyMk_sD.js
[16:25:33.218] ./node_modules/sanity/lib/desk.esm.js
[16:25:33.218] ./sanity.config.ts
[16:25:33.218] ./src/app/(studio)/admin/[[...index]]/page.tsx
[16:25:33.218]
[16:25:33.229]
[16:25:33.229] > Build failed because of webpack errors
[16:25:33.248] error Command failed with exit code 1.
[16:25:33.248] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[16:25:33.270] Error: Command "yarn run build" exited with 1
[16:25:33.967]
Any help with this error please?