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:
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.