Uncaught ReferenceError: require is not defined

when i try
var ccxt = require (‘ccxt’)
console.log (ccxt.exchanges)
i got error
Uncaught ReferenceError: require is not defined
what should i do ??

Hi chatofking

This is almost definitely an issue with the environment you are running on.

It’s important to know that require only works in node and not in client-side JavaScript (like react).

If it is a node project, try removing “type”: “module”, from package.json

Rahul

1 Like