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

[Feature] Can NVS detect package.json's engines.node property ? #184

Closed
Sharlaan opened this issue Feb 10, 2021 · 3 comments
Closed

[Feature] Can NVS detect package.json's engines.node property ? #184

Sharlaan opened this issue Feb 10, 2021 · 3 comments

Comments

@Sharlaan
Copy link

Along its current behavior detecting .nvmrc or .node-version, it would be nice if nvs could detect as well the engines.node property found in package.json

I met this usecase quite often among my clients whree they don't use nvmrc or node-version and don't allow me to add these files, but define an explicit engines.node version.
As a result i can't use nvs on a regular basis since i have to type systematically nvs use <node version required by the project> each time i use a new shell .... every day.
And yes i have tried nvs alias and link, but they don't persist per directory, and i feel a detection mode (like for nvmrc node-version files) sound more appropriate (and direct)

@ljharb
Copy link
Contributor

ljharb commented Feb 10, 2021

engines.node is a version range, and thus is categorically not a good fit for selecting a single version of node (altho it's great for validating one) - for this reason, I think every node version manager has thus far chosen not to pay attention to that field.

@jasongin
Copy link
Owner

Yes, as @ljharb pointed out, engines.node declares the range of node versions that the package is known to be compatible with at runtime. Typically it is a wide range of versions, often encompassing EOL'd / insecure versions, and often unrestricted at the high end, e.g. "node": ">=8.0.0". It's generally not a good source of guidance for auto-selecting a specific version to use. Another consideration is the dev dependencies may have more specific runtime node version requirements. For these reasons, a .node-version or similar file is more appropriate for this purpose.

@OJFord
Copy link

OJFord commented Dec 14, 2021

Ours is locked to major version, which makes sense to me for a closed-source binary/frontend where the only node users are also in control of the package.json.

I realise it's not really the purpose of nvs, but it'd be convenient to be able to use it as a shortcut to install the right version, the latest available that satisfies engines.node. (Plus for those that are using it anyway, needing another node version for some other reason.)

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

4 participants