Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can't walk dependency graph – browserify

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading