nvm-windows icon indicating copy to clipboard operation
nvm-windows copied to clipboard

NVM assumes node installed after failed installation

Open kumarharsh opened this issue 6 years ago • 2 comments

My Environment

  • [ ] Windows 7 or below (not truly supported due to EOL - see wiki for details)

  • [ ] Windows 8

  • [ ] Windows 8.1

  • [x] Windows 10

  • [ ] Windows 10 IoT Core

  • [ ] Windows Server 2012

  • [ ] Windows Server 2012 R2

  • [ ] Windows Server 2016

  • [ ] My Windows installation is non-English.

I'm using NVM4W version:

  • [ ] 1.1.6
  • [ ] 1.1.5
  • [ ] 1.1.4
  • [ ] 1.1.3
  • [ ] 1.1.2
  • [x] 1.1.1
  • [ ] Older
  • [ ] OTHER (Please Specify)

I have already...

  • [x] read the README to be aware of npm gotchas & antivirus issues.
  • [x] 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)

I tried upgrading node to 8.5.0 today on my nvm1.1.1 + powershell + Windows10 Creators Update machine. I put in nvm install 8.5.0 in the terminal. Incidentally, my net connection was acting up, so the laptop dropped the connection just when I pressed enter. NVM showed an error after some time:

Downloading node.js version 8.5.0 (64-bit)... Error while downloading https://nodejs.org/dist/v8.5.0/win-x64//node.exe - read tcp 192.168.2.112:4889->104.20.23.46:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Complete
Creating C:\Users\kumar\AppData\Roaming\nvm\temp

Downloading npm version 5.3.0... Error while downloading https://github.com/npm/npm/archive/v5.3.0.zip - Get https://codeload.github.com/npm/npm/zip/v5.3.0: dial tcp: lookup codeload.github.com: getaddrinfow: No such host is known.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x0 pc=0x496460]

goroutine 1 [running]:
panic(0x6eb740, 0x12e62030)
        C:/Go/src/runtime/panic.go:481 +0x326
_/C_/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web.Download(0x13041f80, 0x2d, 0x12efe5c0, 0x36, 0x0)
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web/web.go:64 +0xab0
_/C_/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web.GetNpm(0x12e429f1, 0x22, 0x131fa380, 0x5, 0x2)
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm/web/web.go:144 +0x43b
main.install(0x12e4c0f0, 0x5, 0x729a48, 0x2)
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:221 +0x11dc
main.main()
        C:/Users/Corey/Documents/workspace/nvm-windows/src/nvm.go:67 +0xde8

After that, I ran the install script again, and got a little surprise:

$> nvm install 8.5.0
Version 8.5.0 is already installed.

What?

Then, I tried switching to this version of node, and check it's version:

$> node --version
Can't create process, ErrCode=0x000000C1, Description:
%1 is not a valid Win32 application.

Current directory:
C:\Workspace

Command to be executed:
"C:\Program Files\nodejs\node.exe" --version

So, I go to the nvm cache folder in C:\Users\kumar\AppData\Roaming\nvm\v8.5.0, and it seems that the node.exe file is only 1MB, whereas the actual node.exe filesize for 7.8.0 is about 20MB. Seems like a borked installation.

Expected Behavior

NVM should gracefully handle failed installs.

Actual Behavior

Broken node version installed.

Steps to reproduce the problem:

  1. Run nvm install x.x.x
  2. Disconnect internet
  3. nvm might fail, but show the version as installed.

kumarharsh avatar Sep 19 '17 06:09 kumarharsh

Try updating NVM4W. Alot of fixes happened after v1.1.1.

coreybutler avatar Sep 20 '17 01:09 coreybutler

Same issue with NVM4W v1.1.6. The downloading fails and the file is broken, but shown as installed.

I think it should be downloaded as a temporary file and renamed to node.exe only if downloaded successfully. Currently even the file is broken, it's named node.js and prevents a re-installation.

gera2ld avatar Nov 26 '17 10:11 gera2ld