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 reports that the version was not installed or could not be found #708

Closed
vladonemo opened this issue Dec 16, 2021 · 47 comments · Fixed by #709
Closed

nvm use reports that the version was not installed or could not be found #708

vladonemo opened this issue Dec 16, 2021 · 47 comments · Fixed by #709

Comments

@vladonemo
Copy link
Contributor

Issue:

How To Reproduce:

nvm install 16
Downloading node.js version 16.13.1 (64-bit)...
Extracting...
Complete

Installation complete. If you want to use this version, type

nvm use 16.13.1

nvm use 16
node vv16.13.1 (64-bit) is not installed or cannot be found.
Please notice the double v in front of the version.

nvm use 16.13.1
Now using node v16.13.1 (64-bit)

Expected Behavior:
nvm use resolves the version properly

Desktop:

  • OS: Windows
vladonemo added a commit to vladonemo/nvm-windows that referenced this issue Dec 16, 2021
For instance, the `nvm use 12` will switch to the latest installed version of 12.*. Similarly, `nvm use 12.22` will switch to the latest installed version of 12.22.*

Fixes coreybutler#708
@Rusinas
Copy link

Rusinas commented Dec 22, 2021

Same here

@Rusinas
Copy link

Rusinas commented Dec 22, 2021

Any workaround while pull request isn't approved?

@nighttiger1990
Copy link

image
Same here I think error is double 'v' character

@vladonemo
Copy link
Contributor Author

@Rusinas the only workaround is to type the full version ;) so do nvm list first and then type the full version, like nvm use 12.22.8. Or take my branch, build and deploy the exe to your machine ;)

@Rusinas
Copy link

Rusinas commented Dec 26, 2021

@Rusinas the only workaround is to type the full version ;) so do nvm list first and then type the full version, like nvm use 12.22.8. Or take my branch, build and deploy the exe to your machine ;)

Nope, typing the full version doesn't work either.

image

I think I'm okay with 16 for now, but any chance your branch will be merged soon?

@matiasperrone
Copy link

matiasperrone commented Jan 10, 2022

Nope, typing the full version doesn't work either.

I have the same issue, I think it does works when you add the letter v before the version works, but you have to be an Administrator (elevated privileges):
image

nvm version 1.1.9

Now as a user:
image

  • "Acceso denegado" = "Access denied"
  • "No se puede crear un archivo que ya existe" = "Is not possible to create a file that already exists"

@iluvboba
Copy link

same issue is happening for me. any idea when it will be fixed?

daxelrod added a commit to daxelrod/jowl that referenced this issue Jan 21, 2022
Switch to installing node on Windows using NVS rather than NVM. NVS is
not installed by default, so use Chocolatey to install it.

NVM currently has two shortcomings that make it difficult to use in automation.

"nvm install 16 && nvm use 16" doesn't work because "use" appears to
need an exact patch version specified, which would involve parsing
the output of "install" or of "list" since we only lock to major verisons.
 coreybutler/nvm-windows#708

"nvm use" and "nvm install" both give successful exit statuses even when
they fail with an error message. This meant that when we did "nvm use
16", it failed because of the above bug, but the job kept on running and
used the default version of Node installed in the image. Working around
this would again involve parsing output.
coreybutler/nvm-windows#738

In my testing, NVS appears to have neither of these problems.

I had also considered installing Node directly via Chocolatey, but
Chocolatey does not yet support installing particular versions unless
the packager has appended the version number to the name. This also
implies that likely only the latest major version gets updates.
@Ethan-Johnson17
Copy link

I've been having this same issue, but when I use the full version I get the response:
exit status 145: The directory is not empty.

exit status 145: The directory is not empty.

Any advice?

@botondev
Copy link

botondev commented Feb 2, 2022

I have the same problem here

@coreybutler
Copy link
Owner

This is addressed in PR #709, which will be merged in an upcoming release.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale Stale label Mar 13, 2022
vladonemo added a commit to vladonemo/nvm-windows that referenced this issue Mar 14, 2022
For instance, the `nvm use 12` will switch to the latest installed version of 12.*. Similarly, `nvm use 12.22` will switch to the latest installed version of 12.22.*

Fixes coreybutler#708
@momaynoy
Copy link

momaynoy commented Mar 14, 2022

run as admin on cmd. now i can use it
image

@github-actions github-actions bot removed the Stale Stale label Mar 15, 2022
@x93008
Copy link

x93008 commented Mar 19, 2022

在 cmd 上以管理员身份运行。现在我可以使用它 图像

I've tried. I can't use it
a

@geniusapc
Copy link

geniusapc commented Mar 19, 2022

I had the same issue, I resolve it by

  • running my cmd as admin
  • installing the node version I want
  • lastly typing nvm use 16.14.2 instead of nvm use 16
    Note: 16.14.2 is the current version on my pc. to check yours use nvm list

Hope this solves your issue

@geniusapc
Copy link

在 cmd 上以管理员身份运行。现在我可以使用它 图像

I've tried. I can't use it a

  • type nvm list to see you node version // eg 16.4.0
  • The type nvm use 16.4.0 Note: the 16.4.0 should be replaced with your installed version

@Harry-Wei
Copy link

I met this issue when I installed 16.4.2 and tried to use it.
The previous version was 10.18.1. I tried most of the solutions above but didn't get it solved.
Then I #1 run nvm on. The version being used was automatically updated to the latest version I installed (17.8.0), although I didn't run "nvm use xx.xx.xx".
After this, I tried to use 16.4.2 but the version was not found as usual. So I #2 run "nvm node_mirror" and "nvm npm_mirror" to set them to the default ones. And I reinstalled 16.4.2. After this, nvm use 16.4.2 took effect.
I am not sure which step is really affecting. Hope the experience can help.
#1 nvm on
#2 set to default mirror, reinstall the version and use it.

@HadiRaiesi
Copy link

i got some error in version 1.1.9 like " exit status 5: Access is denied." or "node vv12.22.12 (64-bit) is not installed or cannot be found" or " folder is not empty" and base of this instruction my problem solved on windows 10 x64 :
1- uninstall any version of node
2- checking folder of nodejs that does not exist in "C:\Program Files\Nodejs". if exist delete "nodejs" folder manualy.
3- by holding shift key on keyboard and click on restart menu , restart your windows. you will see a screen for selecting proper selection. you must select "shut down windows".
4- turn on your computer
5- download and install nvm version 1.1.9 in administrator mode( right click on nvm-setup.exe file and select run as administrator )
6- open "command prompt" by right click on it and select "run as administrator"
7- by using command like " nvm install 12.0.0" install your proper node version. version must be write in right format like xx.x.x ( for example 12.0.0 or 14.20.0 )
8- after completet installation : use command " nvm use 12.0.0" to switch active node version. your current node version will be changed and you will see message like this " Now using node v14.20.0 (64-bit)"
9- if you got an error on switching node version in VSCode Terminal, open vscode in administrator mode by right click on VSCode Icon and open "run as administrator"
10- i hope your problem solved by follow this instruction.
11- all of you are in my heart . good guys. thanks for let me to present this instruction

@Julien-Allard
Copy link

I had the same problem and resolved it by running Git Bash as admin then using the nvm use command with the full version (14.20.0 for me).

@Achorval
Copy link

I solved this problem by typing the full version. Example: nvm use 14.0.0. It works all fine now.

@coreybutler
Copy link
Owner

This is now available in v1.1.10.

@code-soubhik
Copy link

2022-11-08
step 1 - Open Git Bash as an Administrator.
step 2 - Type "node --version" enter.
step 3 - Type "nvm --help" enter to check whether you have install it correctly or not.
step 4 - Type "nvm list available" then hit the enter button.
step 5 - Type "nvm use 18.12.1" (use your version accordingly by seeing the list) and enter.
step 6 - If it shows "node v18.12.1 (64-bit) is not installed.". Type "nvm install 18.12.1"(use your version accordingly)
step 7 - Now type "nvm use 18.12.1" and hit the enter button.
step 8 - Type "nvm current" to recheck whether nvm is using v18.12.1 or not.

This is how I figure it out.
Thank You

@coreybutler coreybutler unpinned this issue Apr 11, 2023
@udidol
Copy link

udidol commented Apr 19, 2023

@coreybutler Still happens to me in v1.1.11 Windows (via installer)

image

@coreybutler
Copy link
Owner

@udidol
Copy link

udidol commented Apr 19, 2023

@coreybutler
Doesn't work in Powershell with admin permissions:
image

@coreybutler
Copy link
Owner

coreybutler commented Apr 19, 2023

You probably have a conflict in your PATH. Use nvm debug to troubleshoot.

@udidol
Copy link

udidol commented Apr 19, 2023

Doesn't seem that way:

image
image

Btw thanks for your quick responses I really appreciate it!

@coreybutler
Copy link
Owner

Do you get an error running C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node.exe -v? How does this compare to running C:\Program Files\nodejs\node.exe -v?

@udidol
Copy link

udidol commented Apr 20, 2023

C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node.exe -v:

C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node.exe : The term 'C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node.exe' is
not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node.exe -v
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\udi\Ap...6.15.1\node.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

C:\Program Files\nodejs\node.exe -v:

C:\Program Files\nodejs\node.exe : The term 'C:\Program Files\nodejs\node.exe' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ C:\Program` Files\nodejs\node.exe -v
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program Files\nodejs\node.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

@udidol
Copy link

udidol commented Apr 20, 2023

These errors make sense:
image

When I ran C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node-v16.15.1-win-x64\node.exe -v, I got:

Program 'node.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1
char:1
+ C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node-v16.15.1-win-x64\node. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ C:\Users\udi\AppData\Roaming\nvm\v16.15.1\node-v16.15.1-win-x64\node. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

@udidol
Copy link

udidol commented Apr 20, 2023

I manually deleted all of the node version folders and I was now able to install and use node 16.20.0. This is very strange but I guess it's ok now.

@coreybutler
Copy link
Owner

It looks like your prior installations weren't unpacked. I'm not sure how that happened because NVM4W unpacks the contents in a temp directory when it writes to the final location. It expects a file structure like this:

image

I'm not sure why this occurred. If you have a mirror setup, it's possible the installers are in a different format. There are other users who have experienced similar symptoms, but it's not common and there is no clear reason why it's happening to some people and not others.

If anyone else runs into this, please open a new issue.

@LiverEatingJohnson
Copy link

I had problems with version node 18 installed, but when I uninstalled 18, "npm use" and "npm list" worked correctly.

@coreybutler
Copy link
Owner

For those reaching this page via Google, upgrade to at least v1.1.11 and run nvm debug. It will catch many configuration problems.

There is one known issue it will not catch yet (in v1.1.11). If you have an invalid Node installation, such as one that didn't failed to extract the files or has no node.exe, then you'll need to reinstall that particular version.

A proper installation should look similar to this:

C:\Users\corey\AppData\Roaming\nvm\v19.6.0
image

An example of an invalid installation:

C:\Users\corey\AppData\Roaming\nvm\v19.2.0
image

A check for this has already been added to the master branch. It will be a part of v1.1.12 when it is released.

@lakhwindergill
Copy link

I was facing the same issue with v20.4.0. Used nvm install v20.4.0 and it is working.
Though it was showing in the list earlier also, but seems like wasn't properly installed.

@lesashley
Copy link

I help running my cmd as admin

@mokagio
Copy link

mokagio commented Jun 17, 2024

Our CI automation reads .nvmrc and interpolates in nvm install and nvm use.

.nvmrc with 18 failed

[2024-06-17T01:36:44Z] Switching to nvm version defined in .nvmrc: 18
[2024-06-17T01:36:45Z] Downloading node.js version 18.20.3 (64-bit)...
[2024-06-17T01:36:45Z] Extracting...
[2024-06-17T01:36:48Z] Complete
[2024-06-17T01:36:48Z]
[2024-06-17T01:36:48Z]
[2024-06-17T01:36:48Z] Installation complete. If you want to use this version, type
[2024-06-17T01:36:48Z]
[2024-06-17T01:36:48Z] nvm use 18.20.3
[2024-06-17T01:36:48Z] node vv18.20.3 (64-bit) is not installed or cannot be found.Refreshing the current PowerShell session's environment

.nvmrc with 18.20.3 succeeded:

[2024-06-17T01:51:44Z] Switching to nvm version defined in .nvmrc: 18.20.3
[2024-06-17T01:51:44Z] Downloading node.js version 18.20.3 (64-bit)...
[2024-06-17T01:51:45Z] Extracting...
[2024-06-17T01:51:48Z] Complete
[2024-06-17T01:51:48Z]
[2024-06-17T01:51:48Z]
[2024-06-17T01:51:48Z] Installation complete. If you want to use this version, type
[2024-06-17T01:51:48Z]
[2024-06-17T01:51:48Z] nvm use 18.20.3
[2024-06-17T01:51:48Z] Now using node v18.20.3 (64-bit)

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 a pull request may close this issue.