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

nvm use with nvmrc as node node v.0.0 (64-bit) is not installed. #388

Closed
7 of 13 tasks
ctsstc opened this issue Sep 2, 2018 · 6 comments
Closed
7 of 13 tasks

nvm use with nvmrc as node node v.0.0 (64-bit) is not installed. #388

ctsstc opened this issue Sep 2, 2018 · 6 comments

Comments

@ctsstc
Copy link

ctsstc commented Sep 2, 2018

My Environment

  • Windows 10

I'm using NVM4W version:

  • 1.1.7

I have already...

  • read the README to be aware of npm gotchas & antivirus issues.
  • reviewed the wiki to make sure my issue hasn't already been resolved.
  • verified I'm using an account with administrative privileges.
  • searched the issues (open and closed) to make sure this isn't a duplicate.
  • made sure this isn't a question about how to use NVM for Windows, since gitter is used for questions and comments.

My issue is related to (check only those which apply):

  • settings.txt
  • proxy support (Have you tried version 1.1.0+?)
  • 32 or 64 bit support (Have you tried version 1.1.3+?)
  • Character escaping (Have you tried version 1.1.6+?)
  • A standard shell environment (terminal/powershell)
  • A non-standard shell environment (Cmder, Hyper, Cygwin, git)

Expected Behavior

Running nvm use with an .nvmrc with node in it should use the latest version of node

Actual Behavior

I see this instead

> nvm use
.0.0
node v.0.0 (64-bit) is not installed

Steps to reproduce the problem:

.nvmrc contents

node

run nvm use

@ctsstc
Copy link
Author

ctsstc commented Sep 2, 2018

I tried to throw in a standard version into the .nvmrc like 10.9.0 and it still has the same error, so now I'm wondering if this is due to my project directory containing a space in it... hmm.

@coreybutler
Copy link
Owner

.nvmrc is not supported. That's an nvm (for Linux) convention. NVM4W is not a mirror of nvm and has no intention of doing so. You can see the different use cases handled by each VM at nodejs/version-management#4.

@paulgwinters
Copy link

paulgwinters commented Jan 16, 2019

FYI, I created a workaround for this functionality by using the following commands in powershell:
type .\.nvmrc | %{$_ -replace "v",""} | %{nvm install $_}
type .\.nvmrc | %{$_ -replace "v",""} | %{nvm use $_}

@basickarl
Copy link

.nvmrc is not supported. That's an nvm (for Linux) convention. NVM4W is not a mirror of nvm and has no intention of doing so. You can see the different use cases handled by each VM at nodejs/version-management#4.

Any reason why this file isn't being used in Windows? It's super useful!

@coreybutler
Copy link
Owner

The .nvmrc file is designed for per-project/shell Node versioning. This is not how Node natively works (i.e. without a version manager). The .nvmrc file depends on a shim, i.e. a an executable file called "node" that redirects commands to the appropriate node executable. In other words, it is a wrapper. In Windows environments, this can create problems executing scripts (the script runs under a different context). This is why NVM4W doesn't use a shim... it's an extra artifact. NVM4W uses symlinks, so calling node.exe directly runs Node (no middleware). The shimming concept is also something some antivirus applications detect, i.e. identifying shimmed applications as a virus.

From a programming perspective, a shim is a nice theory to work with. Commands can be intercepted before the executable is called, making it possible to redirect commands to a different physical executable. Shims read the .nvmrc file to determine which executable commands should be redirected to.

I've not added this to NVM4W mostly because it is symlink-based instead of shim-based. There is no preprocessing of node commands with a direct symlink. Furthermore, these tools are supposed to be node version managers, not developer environment managers.

I do recognize the convenience of an nvmrc/node-version file, but I do not find the shim concept to be a truly viable option for all Windows users - especially those in stricter environments like corporate networks. The alternative is a hooks system. I opened this issue documenting the idea of using hooks. Hooks could achieve the same thing an .nvmrc file offers (plus more). However; I never had time to implement this.

As the JavaScript ecosystem has evolved, I still feel the core tenants of this project are viable for version management. However; I also feel there are better ways to manage JS runtimes (lessons learned from running this project since inception). I feel there are enough advances that it would be better to create a different project. So, I have no intention of adding this to NVM4W, but I do intend to address the need/desires in a different project. See the discussion where I discuss rt (runtime), the successor project I've been working on.

@samraskul
Copy link

first you should install node:
nvm use 16.14.2
and then use node:
nvm use 18

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

5 participants