Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Can't walk dependency graph: Cannot find module 'env!env/file' from './node_modules/requirejs/bin/r.js' #2678

Open
1 task
amulchinock opened this issue Oct 18, 2021 · 2 comments

Comments

@amulchinock
Copy link

amulchinock commented Oct 18, 2021

Type of bug

  • Modernizr error

Describe the bug
When attempting to use the Modernizr runtime with through a compilation tool like Gulp, I get the following error from Node:
Error: Can't walk dependency graph: Cannot find module 'env!env/file' from './node_modules/requirejs/bin/r.js'

How to Reproduce
Install via NPM:

npm install modernizr --save

Initialise Modernizr

const modernizr = require('modernizr');

// Options passed in are those described in https://github.com/Modernizr/Modernizr/blob/master/lib/config-all.json
modernizr.build({ ... });

Expected behavior
This implementation of Modernizr should be parseable without errors during compilation.

Additional context
Modernizr version: 3.11.8

I appreciate that this could be a bug with Requirejs, but I'm not finding any issues similar to mine in either repo at the moment. Based on the fact that requirejs is a dependency of Modernizr, it made sense to report the issue here.

Additionally, I have also confirmed that the issue is not caused by the build tools I am using.

Edit - more context
Interestingly, when testing the example above and compiling with Webpack, we still get errors - but slightly different:

These dependencies were not found:

* generate in /node_modules/modernizr/lib/build.js
* lib/generate-banner in /node_modules/modernizr/lib/build.js
* package in /node_modules/modernizr/lib/build.js

To install them, you can run: npm install --save generate lib/generate-banner package

It feels as if this could be the root of the problem, where Gulp and Webpack are reporting different symptoms of the same problem.

@rejas
Copy link
Member

rejas commented Oct 23, 2021

Thx for the bug report. What node version are you using?

@amulchinock
Copy link
Author

amulchinock commented Oct 28, 2021

Thx for the bug report. What node version are you using?

v14.16.1

Sorry - should have included that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants