React Issues
Cannot convert a BigInt value to a number
If using create-react-app
, without a specific browserlist, the compiler tries to compile for older browser versions.
BigInts are not supported by all browser versions, but are still used in many libraries
This means that you may see the following error when trying to run your react app: Cannot convert a BigInt value to a number
Here is one example in the wild: https://github.com/0xs34n/starknet.js/issues/37#issuecomment-955797303
If you see the error, you can fix it by instructing your compiler to target only recent browser versions. You do this by adding the following to your package.json:
As a precaution, better to also rm -rf node_modules/.cache
before building or running your application again.
Was this page helpful?