Node.js replaceAll is not a function error

Node.js "replaceAll is not a function" Error

A memo on the cause and response when encountering the "replaceAll is not a function" error in Node.js programming. When using the replaceAll() function in Node.js or JavaScript language, you may encounter an error.

Shou Arisaka
1 min read
Nov 2, 2025

A memo on the cause and response when encountering the “replaceAll is not a function” error in Node.js programming. When using the replaceAll() function in Node.js or JavaScript language, you may encounter an error.

The solution is simple: use the replace function instead of the replaceAll function.

"hoge hoge hoge".replaceAll(/ /g, '')
Uncaught TypeError: "hoge hoge hoge".replaceAll is not a function
"hoge hoge hoge".replace(/ /g, '')
'hogehogehoge'
There is no replaceAll in JavaScript [javascript - String.prototype.replaceAll() not working - Stack Overflow](https://stackoverflow.com/questions/13340131/string-prototype-replaceall-not-working)

Share this article

Shou Arisaka Nov 2, 2025

🔗 Copy Links