Using Browserify to bypass the ‘require’ issue.
Have these lines in my code:
let CryptoJS = require('node:crypto')
const util = require('util');
var soap = require('strong-soap').soap;
When I try to bundle the file with Browserify I get:
Can’t walk dependency graph: ENOENT: no such file or directory….
…OpsPrime\Project Chimera\Netsuite SOAP\node:crypto
I have looked at the solutions on here already, didn’t work.
Tried changing node:crypto to just crypto and it did run, but my understanding is the ‘crypto’ module is depreciated and shouldn’t be used, and actually I just encountered further issues.
So I have gone back to using node:crypto but Browserify can’t find it for some reason.
Thank you.
>Solution :
In Node.js, you can require the ‘crypto’ module without the ‘node:’ prefix, as it’s a built-in module. So your code should look like this:
const crypto = require('crypto');
const util = require('util');
const soap = require('strong-soap').soap;
This is the correct way to require the ‘crypto’ module in a Node.js environment. The ‘crypto’ module is not deprecated and is used for cryptographic operations in Node.js. Your code should work as expected with these require statements in a Node.js application.