-
https://dev-switching.netlify.app/
I’m trying to set up an existing Nextjs app in Netlify but it won’t build. The same app is deployed in Vercel atm without issues. Builds work fine locally. Why are they failing in Netlify?
1:28:28 PM: error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
1:28:28 PM: > Build error occurred
1:28:28 PM: Error: next-transpile-modules - an unexpected error happened when trying to resolve "survey". Are you sure the name of the module you are trying to transpile is correct, and it has a package.json with a "main" or an "exports" field?
1:28:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:28:28 PM: Error: Can't resolve 'survey/package.json' in '/opt/build/repo/apps/switching'
at getPackageRootDirectory (/opt/build/repo/node_modules/next-transpile-modules/src/next-transpile-modules.js:128:15)
1:28:28 PM: at Array.map (<anonymous>)
1:28:28 PM: at withTM (/opt/build/repo/node_modules/next-transpile-modules/src/next-transpile-modules.js:137:34)
1:28:28 PM: at Object.<anonymous> (/opt/build/repo/apps/switching/next.config.js:13:18)
1:28:28 PM: at Module._compile (node:internal/modules/cjs/loader:1165:14)
1:28:28 PM: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
1:28:28 PM: at Module.load (node:internal/modules/cjs/loader:1043:32)
1:28:28 PM: at Function.Module._load (node:internal/modules/cjs/loader:878:12)
1:28:28 PM: at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
1:28:28 PM: at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
1:28:28 PM: npm ERR! Lifecycle script `build` failed with error:
1:28:28 PM: npm ERR! Error: command failed
1:28:28 PM: npm ERR! in workspace: switching@0.1.0
1:28:28 PM: npm ERR! at location: /opt/build/repo/apps/switching
My nextjs config and package.json files