I’m getting the following build error when building my next.js app from inside my monorepo.
3:57:49 PM: npm ERR! Cannot set properties of null (setting 'dev'). I have a working build with a slightly different configuration (see below) and the only difference between them, is that I changed the base directory to my next.js apps subdirectory (
/apps/app) and I change directory before running the build command. (hence the
cd ../.. && ).
apps/ ├─ app/ │ ├─ package.json │ ├─ netlify.toml ├─ server/ packages/ ├─ shared/ │ ├─ package.json package.json turbo.json
This configuration yields
3:57:49 PM: npm ERR! Cannot set properties of null (setting 'dev')
Image of the working Configuration.
I couldn’t add the image because new users are limited to one embed per post
With this configuration I need to put the
netlify.tomlat the root of the repo. This makes it impossible to have different configurations for different netlify hosted apps in my repo. So it’s not desired.
My goal with this config is tell netlify to see
/apps/app as the base directory of my app so it uses the netlify.toml in this folder. But it shouldn’t run the build command from inside
It should build from the root of the repo (
/). I need to run the build command at the root of the repo because this triggers turborepo’s build command from the root package.json which also builds the dependency of my next.js app (
Does someone have an idea what could cause this problem? Or alternatively, is there another way to tell netlify where to look for the netlify.toml without setting the base directory?
3:57:24 PM: build-image version: 6c82004ef0368b3a0232c6837cead23188bb347e (focal) 3:57:24 PM: buildbot version: 0dfbdb6e6e614fd26450cfc6bacb47c4c6fd9626 3:57:24 PM: Building without cache 3:57:24 PM: Starting to prepare the repo for build 3:57:24 PM: No cached dependencies found. Cloning fresh repo 3:57:24 PM: git clone --filter=blob:none https://github.com/DATADEER/consistently.space_nextjs 3:57:25 PM: Preparing Git Reference refs/heads/switch-to-monorepo 3:57:25 PM: Parsing package.json dependencies 3:57:26 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'apps/app' versus '/apps/app' in the Netlify UI 3:57:26 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'apps/app/.next' versus '.next' in the Netlify UI 3:57:27 PM: Starting to install dependencies 3:57:27 PM: Using PHP version 8.0 3:57:27 PM: Started restoring cached go cache 3:57:27 PM: Finished restoring cached go cache 3:57:27 PM: Installing Go version 1.19.5 (requested 1.19.5) 3:57:31 PM: go version go1.19.5 linux/amd64 3:57:32 PM: v16.20.0 is already installed. 3:57:32 PM: Now using node v16.20.0 (npm v8.19.4) 3:57:32 PM: Enabling Node.js Corepack 3:57:32 PM: Started restoring cached build plugins 3:57:32 PM: Finished restoring cached build plugins 3:57:32 PM: Started restoring cached corepack dependencies 3:57:32 PM: Finished restoring cached corepack dependencies 3:57:32 PM: npm workspaces detected 3:57:33 PM: Installing npm packages using npm version 8.19.4 3:57:35 PM: npm WARN deprecated firstname.lastname@example.org: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. 3:57:36 PM: npm WARN deprecated email@example.com: Deprecated due to CVE-2021-21366 resolved in 0.5.0 3:57:36 PM: npm WARN deprecated firstname.lastname@example.org: Please use @jridgewell/sourcemap-codec instead 3:57:37 PM: npm WARN deprecated email@example.com: request has been deprecated, see https://github.com/request/request/issues/3142 3:57:37 PM: npm WARN deprecated firstname.lastname@example.org: this library is no longer supported 3:57:39 PM: npm WARN deprecated @email@example.com: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information. 3:57:40 PM: npm WARN deprecated firstname.lastname@example.org: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 3:57:40 PM: npm WARN deprecated email@example.com: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. 3:57:41 PM: npm WARN deprecated firstname.lastname@example.org: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. 3:57:49 PM: npm ERR! Cannot set properties of null (setting 'dev') 3:57:49 PM: npm ERR! A complete log of this run can be found in: 3:57:49 PM: npm ERR! /opt/buildhome/.npm/_logs/2023-04-01T13_57_33_382Z-debug-0.log 3:57:49 PM: Error during npm install 3:57:49 PM: Build was terminated: dependency_installation script returned non-zero exit code: 1 3:57:50 PM: Failed during stage 'Install dependencies': dependency_installation script returned non-zero exit code: 1 3:57:49 PM: Failing build: Failed to install dependencies 3:57:50 PM: Finished processing build request in 25.927s