-
Notifications
You must be signed in to change notification settings - Fork 240
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
RFC for check engines requirements on every install #195
Conversation
You can enable this with |
@ljharb yes, of course it's enabled and even if it's enabled, install does not fail if it's performed by using |
Ah, then that sounds more like a bug then a new feature that requires an rfc :-) when that config flag is set, i would expect the install to check engines with or without a lockfile. |
@ljharb true, i also expected that. But because of several approaches to solve the "bug", i prefer to listen opinions of mainteners of NPM ;) |
@ljharb I disagree with this FWIW. If I'm running Node.js 4 and my dependencies have a minimum requirement of Node.js 24, it's pretty easy to assume they're going to be using features that are not supported in my current runtime. I want to know that my app probably won't work by default rather than continuing to write code oblivious to that. |
@bnb and yet, that's not actually the case in practice. Quite often, packages work fine on engines that are outside the explicitly declared range, and "engines" more serves to declare what they care to support rather than where it works or not. |
We check engines when reifying, and use it as a heuristic when selecting versions during the ideal tree building phase. This should emit a If you aren't seeing those warnings emitted when installing with npm v7, then definitely post a bug about that at https://github.com/npm/cli/issues Ref: |
The suggestion that we re-check packages that aren't being installed is an interesting feature request, but unfortunately would add a significant amount of extra work in the install process. Eg, you install |
What about adding property to the root of lockfile? like
That is exactly the case why i want this feature. We are using CI/CD and want to be sure that it's configured properly (with correct node.js version), because we are using some modern features and better to understand if environment is valid on build stage rather than on running stage :) |
@ljharb @isaacs hey, i saw your conversation about my PR at past RFC meeting and just want to make it clear. I don't suggest to enable |
@markablov My position is effectively:
|
@ljharb so for your 3rd point - if you switch to version Y, and on this version existing lockfile can't be created (because I see that your position is a bit wider, because to follow your 3rd point it would be necessary to bake related options (at least |
Yes, I'd expect that. A lockfile built for node 12 that can't be built for node 14 should not be usable on node 14. |
Implementation issue: npm/arborist#134 |
There's still a PR I need to merge on CLI, a bugfix for platform error message generation. Will try to get this in today. |
This update went out in |
Now if there is shrinkwrap file (or package-lock) NPM does not perform check if package dependencies are satisfied by provided environment (e.g. node/npm versions).