Fix JavaScript Uncaught ReferenceError: require is not defined – JavaScript Tutorial

By | May 18, 2020

We have downloaded a javascript source code from github. However, we get Uncaught ReferenceError: require is not defined error when we are using it. In this tutorial, we will discuss this error and try to fix it.

This error likes:

fix javascript require is not defined error

How to fix this error?

To fix this error and run javascript successfully, you should install node.js.

BecauseĀ require() is not part of the standard JavaScript API. It is a built-in function in Node.js for a special purpose: to load modules.

You should install node.js then run your js in node.js environment. This error will be fixed.

Leave a Reply

Your email address will not be published. Required fields are marked *