Build Failed: MODULE_NOT_FOUND

When attempting to build a clone of the master branch I continue to receive “MODULE_NOT_FOUND” errors at the npm run build stage.

Following are the versions I’m using:

  • Rocky Linux 8 (CentOS 8)
  • Node.js 14.x (latest)
  • npm 6.x (latest)
  • gulp 4.0.0
  • TypeScript 4.2.4

Following are the steps I’ve followed (as per the guide):

  • Clone master branch
  • cd to Babylon.js/Tools/Gulp
  • npm install (completes ok)
  • npm run build - receives the following output:
Error: Cannot find module 'webpack-stream'
Require stack:
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/tasks/gulpTasks-viewerLibraries.js
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/gulpfile.js
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/node_modules/gulp/node_modules/gulp-cli/index.js
- /root/Babylon.js-5.0.0-alpha.60/Babylon.js-5.0.0-alpha.60/Tools/Gulp/node_modules/gulp/bin/gulp.jstype or paste code here

What I’ve tried:

  • Simply running npm install webpack-stream resolves the above issue, but I continue to receive “module not found” errors.
  • Installing each module one-by-one eventually lands on the inability to pass the “module not found” error for fs-extra (even after running npm install fs-extra or npm install -g fs-extra).

Any thoughts?

That’s interesting.

Can you try running npm install in the root directory as well? it should run automatically, but it seems like it was skipped for some reason.

Thanks. I cd’d to Babylon.js (root dir of the clone), ran npm install , went back to Tools/Gulp and now npm run build is running (no longer receiving the errors above).

I’ll let the build run and report any additional issues (if any) - and if no issues will mark as solved. Maybe the build script needs to be updated? I encountered the same issue yesterday when I tried to build Babylon.js on Windows 10 (exact same “module not found” errors).

1 Like

the build system is being revamped and will be replaced in a month or two. It should be simpler to use :slight_smile:

:+1:

@Jason_Daly im guessing you’re having trouble in other projects besides babylon? If so, you can create a .npmrc file and add legacy-peer-deps=true to unbreak the changes npm v7 introduced. You can also set it globally using npm config set legacy-peer-deps true