Build fails but is working on netlify

Hi,

I am pretty new to Cloudflare pages. I would like to use and I also registered a domain here. But the build is working on my computer and also on netlify. But on pages i get this error

22:37:21.302	NPM modules installed
22:37:21.723	Installing Hugo 0.54.0
22:37:22.474	Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
22:37:22.478	Started restoring cached go cache
22:37:22.504	Finished restoring cached go cache
22:37:22.709	go version go1.14.4 linux/amd64
22:37:22.727	go version go1.14.4 linux/amd64
22:37:22.730	Installing missing commands
22:37:22.731	Verify run directory
22:37:22.731	Executing user command: gatsby build
22:37:23.262	tput: unknown terminal "unknown"
22:37:23.758	internal/modules/cjs/loader.js:491
22:37:23.759	  throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
22:37:23.759	  ^
22:37:23.759	
22:37:23.759	Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './is-truthy' is not defined by "exports" in /opt/buildhome/repo/node_modules/gatsby-core-utils/package.json
22:37:23.759	    at applyExports (internal/modules/cjs/loader.js:491:9)
22:37:23.760	    at resolveExports (internal/modules/cjs/loader.js:507:23)
22:37:23.760	    at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
22:37:23.760	    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
22:37:23.760	    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
22:37:23.760	    at Module.require (internal/modules/cjs/loader.js:1026:19)
22:37:23.760	    at require (internal/modules/cjs/helpers.js:72:18)
22:37:23.760	    at Object.<anonymous> (/opt/buildhome/repo/node_modules/gatsby-cli/lib/reporter/reporter.js:34:17)
22:37:23.760	    at Module._compile (internal/modules/cjs/loader.js:1138:30)
22:37:23.760	    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) {
22:37:23.761	  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
22:37:23.761	}
22:37:23.826	Failed: build command exited with code: 1
22:37:24.747	Failed: an internal error occurred

What else confuses me is why Hugo gets installed after all npm modules are installed. I thought these are two different frameworks. At the beginning I selected gatsby in the settings and also checked it.

I updated all packages, googled a lot, but could not find any hint.

I would be very happy about a solution, any idea or hint what it could be.

Currently, Pages setups all up building tools, hugo, npm etc. This will be changing in the future

Have you already set a build environment variable of NODE_VERSION to the same version you have running locally. By default, Pages uses node 12.18.0 which is old.

1 Like

Thank you so much for helping me that fast and precise! With the environment variable for the node version its working now.

At some some point I was wondering how I could adjust some parameters. I should have read the docs/protocol more carefully.

Thank you :hugs:

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