Closed DavidBRohrer closed 2 years ago
I don't think the solution helps. This is a dependency of a dependency. We can't simply change a line of code inside of that. The node_modules
folder is recreated on every machine when installing dependencies via npm install
or npm ci
.
Since we haven't encountered this issue anywhere else yet (neither in tests, nor in local installations, nor in our various public instances), I need a lot more context in order to figure this out. In particular, I need as much information about your environment as possible. jskos-server version/branch, OS, Node and npm versions, are you using Docker and if yes, which version, etc. I need to reproduce this issue so I need anything you can give me. Thanks!
It would also be very helpful to get the full error stack, in order to see where in OUR code the error occurred.
This is the full error code:
/home/david/Dokumente/jskos-server/node_modules/whatwg-url/dist/encoding.js:2 const utf8Encoder = new TextEncoder(); ^
ReferenceError: TextEncoder is not defined
at Object.
Environment:
- node: 10.19.0
You need at least Node.js 12 to run jskos-server. I wouldn't recommend using Node.js 10 since it's long out of maintenance already. I would recommend using fnm to manage Node versions and install at least Node.js 14 to run our software.
However, this issue made me realize that this is not documented anywhere. That's my fault; I'll update the documentation!
npm install
/npm ci
will now throw an error if you try to use it with an unsupported Node.js version.
When running jskos-server (npm run start) an error occurs.
Problem: in the file jskos-server/node_modules/whatwg_url/dist/encoding.js in line 2 "new TextEncoder();" "TextEncoder" is not defined.
Solution: add following string to line 2: "const { TextEncoder, TextDecoder } = require("util");" (Source: https://stackoverflow.com/questions/19697858/referenceerror-textencoder-is-not-defined)