I have experienced this issue for more than one of my ember apps now, failing to build, resulting in the error:
TextEncoder is not defined
12:35:48 AM: TextEncoder is not defined
12:49:53 AM: ERROR Summary:
12:49:53 AM: - broccoliBuilderErrorStack: [undefined]
12:49:53 AM: - code: [undefined]
12:49:53 AM: - codeFrame: [undefined]
12:49:53 AM: - errorMessage: TextEncoder is not defined
12:49:53 AM: - errorType: [undefined]
12:49:53 AM: - location:
12:49:53 AM: - column: [undefined]
12:49:53 AM: - file: [undefined]
12:49:53 AM: - line: [undefined]
12:49:53 AM: - message: TextEncoder is not defined
12:49:53 AM: - name: ReferenceError
12:49:53 AM: - nodeAnnotation: [undefined]
12:49:53 AM: - nodeName: [undefined]
12:49:53 AM: - originalErrorMessage: [undefined]
12:49:53 AM: - stack: ReferenceError: TextEncoder is not defined
12:49:53 AM: at Object. (/opt/build/repo/node_modules/whatwg-url/lib/encoding.js:2:21)
12:49:53 AM: at Module._compile (internal/modules/cjs/loader.js:778:30)
12:49:53 AM: at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
12:49:53 AM: at Module.load (internal/modules/cjs/loader.js:653:32)
12:49:53 AM: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
12:49:53 AM: at Function.Module._load (internal/modules/cjs/loader.js:585:3)
12:49:53 AM: at Module.require (internal/modules/cjs/loader.js:692:17)
12:49:53 AM: at require (internal/modules/cjs/helpers.js:25:18)
12:49:53 AM: at Object. (/opt/build/repo/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
12:49:53 AM: at Module._compile (internal/modules/cjs/loader.js:778:30)
It probably has more to do with using an Outdated NodeJS version pinned to version 10
, for build images: ReferenceError: TextEncoder is not defined · Issue #235 · jsdom/whatwg-url · GitHub
I have now updated an app to embroider, ember 4, but the deployments will fail as long as the build images use Node 10. Note that LTS is 16.17.0
. How can Netlify users build ember apps with build images set to use Node version 10?
(One idea might involve pinning a fork of whatwg-url
to the dependencies
of the package.json
, but that seems like a hacky solution to me).