Skip to content

Specify node engine minimum version #218

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

Merged
merged 1 commit into from
Apr 10, 2016
Merged

Conversation

dreyescat
Copy link
Contributor

Setting the minimum version of the node engine will make npm to warn or
complain, if node engine-strict config is set to true, whenever the
installation environment does not meet this requirement.

Background:

css-loader depends on postcss that uses native promises. Promises
where introduced in node version 0.12.0. So css-loader
transitively inherits this dependency.

Related to #144.

Setting the minimum version of the node engine will make npm to warn or
complain, if node `engine-strict` config is set to true, whenever the
installation environment does not meet this requirement.

Background:

`css-loader` depends on `postcss` that uses native promises. Promises
where introduced in node version 0.12.0. So `css-loader`
*transitively inherits* this dependency.

Related to webpack-contrib#144.
@dreyescat
Copy link
Contributor Author

It looks like that forcing engineStrict per package was deprecated since npm version 3.0.0.
The user needs to explicitly specify in config if npm will stubbornly refuse to install setting the engine-strict option to true. Otherwise a simple warning will be shown.

With this change using a node version below 0.12.0

  • with engine-strict mode set to true we will get:
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Required: {"node":">=0.12.0"}
npm ERR! notsup Actual:   {"npm":"1.4.28","node":"0.10.40"}
  • with engine-strict set to false we will get:
npm WARN engine [email protected]: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.40","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"0.10.40","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.40","npm":"1.4.28"})

As you can see postcss and csso dependencies already have this requirement and probably should be enough because they are actually the ones that introduced this requirement (use node native Promises). So it might be fair just to let them warn of this requirement and not css-loader who doesn't seem to need this requirement per se.

But... If you set engine-strict to true to the version css-loader without this change, then you get a really confusing message:

npm ERR! notarget No compatible version found: postcss@'>=5.0.10-0 <6.0.0-0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.2.0","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4","0.3.5","1.0.0","2.0.0","2.1.0","2.1.1","2.1.2","2.2.0","2.2.1","2.2.2","2.2.3","2.2.4","2.2.5","2.2.6","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.0.7","4.0.0","4.0.1","4.0.2","4.0.3","4.0.4","4.0.5","4.0.6","4.1.0","4.1.1","4.1.2","4.1.3","4.1.4","4.1.5","4.1.6","4.1.7","4.1.8","4.1.9","4.1.10","4.1.11","4.1.12","4.1.13","4.1.14","4.1.15","4.1.16","5.0.0","5.0.1","5.0.2","5.0.3","5.0.4","5.0.5","5.0.6"]

So, even this is not a css-loader issue maybe it is good to keep just to get better feedback to end users (compare the two outputs when engine-strict is set to true).

Feel free to reject this PR if you think it is not going to be helpful 😉.

@sokra sokra merged commit b6acfec into webpack-contrib:master Apr 10, 2016
@sokra
Copy link
Member

sokra commented Apr 10, 2016

Thanks

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

Successfully merging this pull request may close these issues.

2 participants