Next.js build errors?

Trying to see if we can move from Vercel to Cloudflare Pages, but not looking good. Our basic Next.js app won’t even build. Any thoughts on what’s wrong wrong here? It builds fine locally (and on Vercel).

2024-05-06T21:05:30.646358Z	Cloning repository...
2024-05-06T21:05:32.006464Z	From[REDACTED]
2024-05-06T21:05:32.006912Z	 * branch            8d4781e3d78fe287c61e1ccd0d1997b5c0f6dbad -> FETCH_HEAD
2024-05-06T21:05:32.162927Z	HEAD is now at 8d4781e Merge pull request #32 from [REDACTED]/dev-2
2024-05-06T21:05:32.245364Z	Using v2 root directory strategy
2024-05-06T21:05:32.271421Z	Success: Finished cloning repository files
2024-05-06T21:05:34.028819Z	Checking for configuration in a wrangler.toml configuration file (BETA)
2024-05-06T21:05:34.114819Z	No wrangler.toml file found. Continuing.
2024-05-06T21:05:34.266543Z	Detected the following tools from environment: [email protected], [email protected]
2024-05-06T21:05:34.2672Z	Installing project dependencies: yarn
2024-05-06T21:05:34.826046Z	➤ YN0070: Migrating from Yarn 1; automatically enabling the compatibility node-modules linker 👍
2024-05-06T21:05:34.893355Z	➤ YN0000: ┌ Resolution step
2024-05-06T21:05:35.279093Z	➤ YN0061: │ next-google-fonts@npm:2.2.0 is deprecated: As of Next.js 10.2, Google Fonts are automatically optimized! For more info, see
2024-05-06T21:05:35.343044Z	➤ YN0061: │ @types/redux-persist@npm:4.3.1 is deprecated: This is a stub types definition for redux-persist ( redux-persist provides its own type definitions, so you don't need @types/redux-persist installed!
2024-05-06T21:05:35.446797Z	➤ YN0061: │ @types/next@npm:9.0.0 is deprecated: This is a stub types definition. next provides its own type definitions, so you do not need this installed.
2024-05-06T21:05:36.074796Z	➤ YN0032: │ fsevents@npm:2.3.3: Implicit dependencies on node-gyp are discouraged
2024-05-06T21:05:42.695326Z	➤ YN0002: │ @types/next@npm:9.0.0 doesn't provide react (pfef19), requested by next
2024-05-06T21:05:42.695643Z	➤ YN0002: │ @types/next@npm:9.0.0 doesn't provide react-dom (pc4de4), requested by next
2024-05-06T21:05:42.695772Z	➤ YN0002: │ @types/redux-persist@npm:4.3.1 doesn't provide redux (p523af), requested by redux-persist
2024-05-06T21:05:42.69606Z	➤ YN0002: │ torun@workspace:. doesn't provide jquery (pf52b5), requested by slick-carousel
2024-05-06T21:05:42.696416Z	➤ YN0002: │ torun@workspace:. doesn't provide react-native (pe1be7), requested by @react-native-async-storage/async-storage
2024-05-06T21:05:42.696514Z	➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
2024-05-06T21:05:42.701739Z	➤ YN0000: └ Completed in 7s 808ms
2024-05-06T21:05:42.745412Z	➤ YN0000: ┌ Post-resolution validation
2024-05-06T21:05:42.745681Z	➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
2024-05-06T21:05:42.745851Z	➤ YN0000: └ Completed
2024-05-06T21:05:42.745947Z	➤ YN0000: Failed with errors in 7s 857ms
2024-05-06T21:05:42.807178Z	Error: Exit with error code: 1
2024-05-06T21:05:42.8074Z	    at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
2024-05-06T21:05:42.807903Z	    at Object.onceWrapper (node:events:652:26)
2024-05-06T21:05:42.808023Z	    at ChildProcess.emit (node:events:537:28)
2024-05-06T21:05:42.808226Z	    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
2024-05-06T21:05:42.818346Z	Failed: build command exited with code: 1
2024-05-06T21:05:43.829313Z	Failed: error occurred while running build command

It looks like Cloudflare Pages is using Yarn 3, and you’re maybe using Yarn 1 locally?
You could try upgrading locally, or try setting YARN_VERSION: 1 env in the Pages project config

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.