0

Problem When trying to build my bundle.js file, I get the following:

Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat 'C:\[filepath&filename]\stream'
    required by C:\[filepath]\script.js

My package.json file is as follows:

{
  "name": "[projectName]",
  "version": "1.0.0",
  "description": "",
  "main": "script.js",
  "scripts": {
    "build": "browserify script.js -o bundle.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "browserify": "^17.0.0",
    "crypto-js": "^4.1.1",
    "stream-consumers": "^1.0.2"
  }
}

High level, the code I'm trying to run is as follows:

var CryptoJS = require('crypto-js'); 
const { json } = require('stream/consumers');

function doSomething() {

}
doSomething();

What I've tried I've tried a number of different recommended ways to fix this, including:

  • Adding './' - as recommended here which gives 'Cannot find module'
  • Deleting package-lock.json file and then installing the packages I wanted to install - as recommended here
e-driver1
  • 45
  • 7

1 Answers1

0

This unblocked the issue for me.

It turned out that:

const { json } = require('stream/consumers');

wasn't required, so when I commented it out, it seemed to resolve the issue...

e-driver1
  • 45
  • 7