Skip to content

--ignore-optional is broken #4876

@benesch

Description

@benesch

Do you want to request a feature or report a bug?
Bug!

What is the current behavior?

$ yarn add webpack webpack-dev-server
...
Done in 6.34s.
$ node_modules/.bin/webpack-dev-server 
No configuration file found and no entry configured via CLI option.
When using the CLI you need to provide at least two arguments: entry and output.
A configuration file could be named 'webpack.config.js' in the current directory.
Use --help to display the CLI options.
# This indicates the module installed properly.
$ rm -rf node_modules
$ yarn install --ignore-optional
$ node_modules/.bin/webpack-dev-server 
module.js:538
    throw err;
    ^

Error: Cannot find module 'fs.realpath'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/benesch/Desktop/t/node_modules/glob/glob.js:44:10)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

What is the expected behavior?

yarn install --ignore-optional should install a working set of dependencies. It appears a transitive dep is somehow causing fs.realpath to look like it's optional, when it is in fact required.

Please mention your node.js, yarn and operating system version.

macOS Sierra 10.12.6

$ node --version
v8.9.0
$ yarn --version
1.3.2

/cc @arcanis @BYK I suspect this might be related to #3976.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions