nodeenv icon indicating copy to clipboard operation
nodeenv copied to clipboard

Add support for a .node-version file

Open nikolay opened this issue 10 years ago • 6 comments

It would be nice to be able to install the node version specified in .node-version (similar to some Python and Ruby and environment managers). I don't think .nvmrc, which is used by nvm is a good choice, because it's tied to the nvm branding.

nikolay avatar Oct 06 '15 20:10 nikolay

@ekalinin Any update?

nikolay avatar Feb 23 '16 18:02 nikolay

Hey @nikolay Sorry for delay.

Did you try .nodeenvrc?

  • https://github.com/ekalinin/nodeenv#configuration

Default values are:

➥ nodeenv --dump-config-defaults
    [nodeenv]
    debug = False
    jobs = 2
    make = make
    node = latest
    npm = latest
    prebuilt = False
    profile = False
    with_npm = False
    without_ssl = False

ekalinin avatar Feb 23 '16 19:02 ekalinin

Hi @ekalinin, this would be very useful for me as well, the main reason not to use .nodeenvrc would be to have the node version specified by the repository. If it lives at ~/.nodeenvrc it has to be the same for all environments. Or perhaps .nodeenvrc from the current folder could be used first if it exists?

agentreno avatar Oct 07 '16 08:10 agentreno

@ekalinin I know that, but it is global per user - I need this per project. I have a per project virtualenv where I install nodeenv and thus I want the Node.js version to be specific for that virtualenv/project as well, not be globally configured as different projects may use different versions. There could be a hierarchy of the checks - project's home folder first, then in $HOME, then globally.

nikolay avatar Oct 07 '16 16:10 nikolay

@ekalinin right, it would be very useful, specially if you think about a way to start contributing to a project: instead to know what version of node you should install, simply creating the virtual env the right version is automatically installed.

Furthermore, I suggest to use node engines, using the most newer version in range, instead a new and separate config file.

Could we open a pull request?

canemacchina avatar May 14 '18 14:05 canemacchina

I see support for .node-version file was added in #288

For interest, I have been documenting node version managers which read .node-version file: https://github.com/shadowspawn/node-version-usage

shadowspawn avatar Apr 10 '23 05:04 shadowspawn