Cloudflare pages nodejs v12.18.0 does not support Optional chaining operator SyntaxError: Unexpected token '.'

cloudflare pages nodejs v12.18.0 does not support Optional chaining operator

SyntaxError: Unexpected token ‘.’

You can change the version of Node with the environment variable NODE_VERSION

Check the docs: https://developers.cloudflare.com/pages/platform/build-configuration#language-support-and-tools

1 Like

nodejs Error: Cannot find module ‘fs/promises’

bug in cloudflare pages

11:17:46.149 Initializing build environment. This may take up to a few minutes to complete
11:19:33.334 Success: Finished initializing build environment
11:19:33.334 Cloning repository…
11:19:35.849 Success: Finished cloning repository files
11:19:37.417 Installing dependencies
11:19:37.420 Python version set to 2.7
11:19:38.505 v12.18.0 is already installed.
11:19:38.921 Now using node v12.18.0 (npm v6.14.4)

11:20:27.434 > @masx200/[email protected] copyfiles /opt/buildhome/repo
11:20:27.434 > node utils/linkfiles.js --type=copy
11:20:27.434
11:20:27.487 internal/modules/cjs/loader.js:969
11:20:27.487 throw err;
11:20:27.487 ^
11:20:27.487
11:20:27.487 Error: Cannot find module ‘fs/promises’
11:20:27.487 Require stack:
11:20:27.487 - /opt/buildhome/repo/utils/linkfiles.js
11:20:27.487 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
11:20:27.487 at Function.Module._load (internal/modules/cjs/loader.js:842:27)
11:20:27.488 at Module.require (internal/modules/cjs/loader.js:1026:19)
11:20:27.488 at require (internal/modules/cjs/helpers.js:72:18)
11:20:27.488 at Object. (/opt/buildhome/repo/utils/linkfiles.js:6:20)
11:20:27.488 at Module._compile (internal/modules/cjs/loader.js:1138:30)
11:20:27.488 at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)
11:20:27.488 at Module.load (internal/modules/cjs/loader.js:986:32)
11:20:27.488 at Function.Module._load (internal/modules/cjs/loader.js:879:14)
11:20:27.488 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
11:20:27.488 code: ‘MODULE_NOT_FOUND’,
11:20:27.488 requireStack: [ ‘/opt/buildhome/repo/utils/linkfiles.js’ ]
11:20:27.488 }
11:20:27.500 npm ERR! code ELIFECYCLE
11:20:27.500 npm ERR! errno 1
11:20:27.501 npm ERR! @masx200/[email protected] copyfiles: node utils/linkfiles.js --type=copy
11:20:27.501 npm ERR! Exit status 1
11:20:27.501 npm ERR!
11:20:27.501 npm ERR! Failed at the @masx200/[email protected] copyfiles script.
11:20:27.501 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:20:27.505
11:20:27.505 npm ERR! A complete log of this run can be found in:
11:20:27.505 npm ERR! /opt/buildhome/.npm/_logs/2021-06-27T03_20_27_501Z-debug.log
11:20:27.515 npm ERR! code ELIFECYCLE
11:20:27.515 npm ERR! errno 1
11:20:27.515 npm ERR! @masx200/[email protected] build: npm run prod &&npm run copyfiles
11:20:27.515 npm ERR! Exit status 1
11:20:27.515 npm ERR!
11:20:27.515 npm ERR! Failed at the @masx200/[email protected] build script.
11:20:27.515 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:20:27.516
11:20:27.516 npm ERR! A complete log of this run can be found in:
11:20:27.516 npm ERR! /opt/buildhome/.npm/_logs/2021-06-27T03_20_27_513Z-debug.log
11:20:27.523 Failed: build command exited with code: 1

Cloudflare pages nodejs v12.18.0 does not support Optional chaining operator SyntaxError: Unexpected token ‘.’ - General - Cloudflare Community

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