Tuesday, October 25, 2022
HomeGame DevelopmentError: Present surroundings doesn't present a require() for requiring 'crypto' - Cocos...

Error: Present surroundings doesn’t present a require() for requiring ‘crypto’ – Cocos Creator


Howdy!
I bumped into an issue. I imported the library into the challenge, however I find yourself getting an error once I begin the challenge:

Error: Present surroundings doesn't present a require() for requiring 'crypto'.

I’ve tried many options discovered within the documentation and on third-party websites. However nothing labored. How can I remedy this downside?

As I perceive third celebration packages which I import have require() perform which isn’t supported by present surroundings. However I can’t determine methods to repair it.


You may consult with this doc to make use of crypto:

Thanks for the reply, however this resolution didn’t assist.
I’ll attempt to let you know extra in regards to the error.
I’m making an attempt to import @solana/web3.js into the challenge.

Import * as solanaWeb3 from "@solana/web3.js";

However as quickly as I attempt to use the instance from the documentation:

console.log(solanaWeb3);

An error happens (it’s seen with the developer instruments within the browser):

Error: Present surroundings doesn't present a require() for requiring 'crypto'.
    manufacturing unit cjs-loader.mjs:93
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute crypto.js:14
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute utils.js:33
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute _sha2.js:16
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute sha512.js:19
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    _createRequire cjs-loader.mjs:105
    _createRequireWithResolveMap cjs-loader.mjs:112
    execute index.cjs.js:107
    _load cjs-loader.mjs:78
    _tryModuleLoad cjs-loader.mjs:63
    _require cjs-loader.mjs:42
    require cjs-loader.mjs:27
    execute index.cjs.mjs:7
    doExec system.js:482
    postOrderExec system.js:472
    postOrderExec system.js:461
    postOrderExec system.js:459
    postOrderExec system.js:461
    postOrderExec system.js:459
    C system.js:406

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments