Question:
My code all works locally (running Node 17.4.0).But as I mentioned here, when I deploy to my production server at Render.com, which says
Detected Node version 17.4.0
(which is the same version that I use for local development), functions throw errors like:TypeError: (0 , crypto__WEBPACK_IMPORTED_MODULE_0__.randomUUID)(...).replaceAll is not a function
.TypeError: (intermediate value).format(...).replaceAll is not a function at getShortLocalizedDate
How can I ensure that
replaceAll
can work on my production server?P.S. I think Node has supported
replaceAll
since v15.Answer:
Some things to check: Do you maybe have something else overriding the Node version set inengines.node
? According to https://render.com/docs/node-version, the engines.node
value will be overridden by- A
NODE_VERSION
environment variable - A
.node-version
file at the root of your repo - A
.nvmrc
file at the root of your repo.
Also, when you deploy on Render, are you selecting Node as the Environment?
Here’s a small test deploy to Render I created to verify that odd Node version numbers work on Render and also to verify that
replaceAll()
works in Node v17.4.0.Code (also at https://github.com/crcastle/test-replaceall)
server.js
:package.json
:If you have better answer, please add a comment about this, thank you!