• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: `replaceAll` is not working in Next.js (Node.js) when deployed to Render.com server

Resolved: `replaceAll` is not working in Next.js (Node.js) when deployed to Render.com server

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

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 in engines.node? According to https://render.com/docs/node-version, the engines.node value will be overridden by
  1. A NODE_VERSION environment variable
  2. A .node-version file at the root of your repo
  3. 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:
Output (also temporarily deployed to https://test-replaceall.onrender.com)
Build and deploy log

If you have better answer, please add a comment about this, thank you!

javascript next.js node.js
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Java Virtual Machines deleted

27/03/2023

Resolved: PyCharm cannot see my newly compiled .pyc see on import

27/03/2023

Resolved: I am facing ERR_HTTP2_PROTOCOL_ERROR on my website

27/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.