jonnyzzz / TeamCity.Node

Node.js, NPM and Phantom.JS runners for TeamCity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows: node.js NPM step not using NVM installed NPM

alex3305 opened this issue · comments

Plugin version: 2.0.21
Operating System: Windows

We are having issues regarding Windows use with this plugin. It seems that #133 is solved, hence I closed that issue. But when we are using this plugin on Windows we don't get the expected results:

Test with an already downloaded Node/NPM version

[10:34:47]Step 1/4: Node.js NVM Installer (1s)
[10:34:47][Step 1/4] Download: Fetching NVM
[10:34:47][Download] Downloading creatonix/nvm...
[10:34:47][Download] from https://github.com/nvm-sh/nvm/archive/v0.34.0.zip
[10:34:48][Download] NVM downloaded into C:\buildagent\system\jonnyzzz.nvm
[10:34:48][Step 1/4] Install: Installing Node.js v11.10.1
[10:34:48][Install] Content of C:\buildagent\temp\agentTmp\custom_script986550255663020937.cmd file: 
@echo off
rem This is a custom script written by TeamCity using windows-1252 charset.
nvm install  11.10.1
[10:34:48][Install] Starting: C:\buildagent\temp\agentTmp\custom_script986550255663020937.cmd
[10:34:48][Install] in directory: C:\buildagent\system\jonnyzzz.nvm
[10:34:48][Install] Version 11.10.1 is already installed.
[10:34:48][Install] Process exited with code 0
[10:34:48][Step 1/4] Use: Selecting Node.js v11.10.1
[10:34:48][Use] Content of C:\buildagent\temp\agentTmp\custom_script3320413370876892816.cmd file: 
@echo off
rem This is a custom script written by TeamCity using windows-1252 charset.
nvm use 11.10.1
[10:34:48][Use] Starting: C:\buildagent\temp\agentTmp\custom_script3320413370876892816.cmd
[10:34:48][Use] in directory: C:\buildagent\system\jonnyzzz.nvm
[10:34:48][Use] Now using node v11.10.1 (64-bit)
[10:34:48][Use] Process exited with code 0
[10:34:48]Step 2/4: Get versions (Node.js NPM) (2s)
[10:34:49][Step 2/4] Executing npm via wrapping shell script
[10:34:49][Step 2/4] Starting: cmd /c npm --version
[10:34:49][Step 2/4] in directory: C:\buildagent\work\8b67de1dfe50419b
[10:34:49][Step 2/4] npm --version (2s)
[10:34:51][npm --version] 3.10.10
[10:34:51][Step 2/4] Process exited with code 0

Test with a newly downloaded Node/NPM version

[11:29:05]Step 1/4: Node.js NVM Installer (8s)
[11:29:05][Step 1/4] Download: Fetching NVM (1s)
[11:29:05][Download] Downloading creatonix/nvm...
[11:29:05][Download] from https://github.com/nvm-sh/nvm/archive/v0.34.0.zip
[11:29:06][Download] NVM downloaded into C:\buildagent\system\jonnyzzz.nvm
[11:29:06][Step 1/4] Install: Installing Node.js v12.5.0 (7s)
[11:29:06][Install] Content of C:\buildagent\temp\agentTmp\custom_script1380167461566544351.cmd file: 
@echo off
rem This is a custom script written by TeamCity using windows-1252 charset.
nvm install  12.5.0
[11:29:06][Install] Starting: C:\buildagent\temp\agentTmp\custom_script1380167461566544351.cmd
[11:29:06][Install] in directory: C:\buildagent\system\jonnyzzz.nvm
[11:29:07][Install] Downloading node.js version 12.5.0 (64-bit)... 
[11:29:12][Install] Complete
[11:29:14][Install] Downloading npm version 6.9.0... Download failed. Rolling Back.
[11:29:14][Install] Rollback failed. remove C:\Users\deployagent\AppData\Roaming\nvm\temp\npm-v6.9.0.zip: The process cannot access the file because it is being used by another process.
[11:29:14][Install] Could not download npm for node v12.5.0.
[11:29:14][Install] Please visit https://github.com/npm/npm/releases/tag/v6.9.0 to download npm.
[11:29:14][Install] It should be extracted to C:\Users\deployagent\AppData\Roaming\nvm\v12.5.0
[11:29:14][Install] Process exited with code 0
[11:29:14][Step 1/4] Use: Selecting Node.js v12.5.0
[11:29:14][Use] Content of C:\buildagent\temp\agentTmp\custom_script3286027515988028270.cmd file: 
@echo off
rem This is a custom script written by TeamCity using windows-1252 charset.
nvm use 12.5.0
[11:29:14][Use] Starting: C:\buildagent\temp\agentTmp\custom_script3286027515988028270.cmd
[11:29:14][Use] in directory: C:\buildagent\system\jonnyzzz.nvm
[11:29:14][Use] Now using node v12.5.0 (64-bit)
[11:29:14][Use] Process exited with code 0
[11:29:14]Step 2/4: Get versions (Node.js NPM) (2s)
[11:29:14][Step 2/4] Executing npm via wrapping shell script
[11:29:14][Step 2/4] Starting: cmd /c npm --version
[11:29:14][Step 2/4] in directory: C:\buildagent\work\8b67de1dfe50419b
[11:29:14][Step 2/4] npm --version (2s)
[11:29:16][npm --version] 3.10.10
[11:29:16][Step 2/4] Process exited with code 0

So maybe this are two different issues. But they seem to have some sort relation to each other. The second time that you'll try to install an NPM version it works wonderfully though, but the build step will simply not use that version.

@jonnyzzz About not using the correct node version. It seems this is the issue: coreybutler/nvm-windows#321 (comment)

Maybe this can be added to the documentation?


About the issue not able to install the first time, that still exists. It seems that this is a permission or locked file issue when downloading new node versions. But perhaps this is related to nvm and not this plugin.

Closing this issue because of that. Thanks for your help.