jonnyzzz / TeamCity.Node

Node.js, NPM and Phantom.JS runners for TeamCity
Apache License 2.0
309 stars 49 forks source link

Node.js NVM Installer fails to select Node Version #190

Open peter9teufel opened 7 months ago

peter9teufel commented 7 months ago

Latest TeamCity version, plugin version teamcity-node-2.0.27

The build step to install and select a specific node version (version 14 required in our case) fails.

06:18:22  Step 1/3: NVM 14 Install (Node.js NVM Installer) 06:18:22  Download: Fetching NVM 06:18:22  Downloading nvm-sh/nvm... 06:18:22  from https://github.com/nvm-sh/nvm/archive/v0.39.2.zip 06:18:23  NVM downloaded into /opt/JetBrains/TeamCity/buildAgent/system/jonnyzzz.nvm 06:18:23  Install: Installing Node.js v14.21.3 06:18:23  Starting: /opt/JetBrains/TeamCity/buildAgent/temp/agentTmp/custom_script5004199583965402415 06:18:23  in directory: /opt/JetBrains/TeamCity/buildAgent/system/jonnyzzz.nvm 06:18:24  Downloading and installing node v14.21.3... 06:18:25  Downloading https://nodejs.org/dist/v14.21.3/node-v14.21.3-linux-x64.tar.xz... 06:18:25  06:18:25  ######### 13,2% 06:18:25  ################################################## 70,4% 06:18:25  ######################################################################## 100,0% 06:18:25  Computing checksum with sha256sum 06:18:25  Checksums matched! 06:18:29  Now using node v14.21.3 (npm v6.14.18) 06:18:29  Creating default alias: default -> 14.21.3 (-> v14.21.3 *) 06:18:29  Process exited with code 0 06:18:29  Use: Selecting Node.js v14.21.3 06:18:29  Starting: /opt/JetBrains/TeamCity/buildAgent/temp/agentTmp/custom_script7487676735048777800 06:18:29  in directory: /opt/JetBrains/TeamCity/buildAgent/system/jonnyzzz.nvm 06:18:30  Now using node v14.21.3 (npm v6.14.18) 06:18:30  Error: Invalid or corrupt jarfile /opt/JetBrains/TeamCity/buildAgent/plugins/environment-fetcher/lib/environment-fetcher-bin-2024.03-156166-jar-with-dependencies.jar 06:18:30  Process exited with code 1 06:18:30  Process exited with code 1 (Step: ) 06:18:31  Step NVM 14 Install (Node.js NVM Installer) failed

This currently blocks us from building a frontend for our project that requires a different node version, thanks for taking a look into it.

Best regards, Peter

inekrashevych-callfire commented 7 months ago

same for me. also opened a bug for teamcity youtrack. seems like disabling the environment-fetcher plugin eliminates the error, but not sure it is a good idea to disable the bundled plugin.

eumpek commented 7 months ago

We are facing the same issue after updating to TC 2024.03 and Node.js build rinner to 2.0.27.

benhart commented 7 months ago

ICYMI the bug @inekrashevych-callfire opened on youtrack has a new environment-fetcher plugin that can be downloaded and patched on TC. This has resolved the issue for us.

simongh commented 7 months ago

Neither the new plugin nor disabling environment fetcher worked for me.

I still get

ERROR - gins.spring.SpringPluginLoader - Error loading plugin 'teamcity-node-agent-2.0.26': Failed to initialize spring context: Error creating bean with name 'com.jonnyzzz.teamcity.plugins.node.agent.nvm.NVMRunner#0' defined in Byte array resource [plugin: teamcity-node-agent-2.0.26#teamcity-node-agent-2.0.26.jar!/META-INF/build-agent-plugin-node.xml]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.jonnyzzz.teamcity.plugins.node.agent.processes.CompositeProcessFactoryImpl#0': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.jonnyzzz.teamcity.plugins.node.agent.processes.CompositeProcessFactoryImpl] from ClassLoader [PluginStandaloneClassLoader{plugin=teamcity-node-agent-2.0.26 parent=java.net.URLClassLoader@37a71e93}] 

I'm going to have to try adding a manual script to run the node steps directly & hope that works

inekrashevych-callfire commented 7 months ago

2.0.27 is the right version to install. You have wrong version.

apps4everyone commented 7 months ago

@inekrashevych-callfire we installed the version 2.0.27 but getting this error: Error: Invalid or corrupt jarfile /opt/buildagent/plugins/environment-fetcher/lib/environment-fetcher-bin-2024.03-156166-jar-with-dependencies.jar What java version is required? do those still work with java 11?

apps4everyone commented 7 months ago

files uploaded to the server are from here https://teamcity.jetbrains.com/repository/download/bt434/4548373:id/teamcity-node-2.0.27.zip

kir commented 7 months ago

Hi, the problem with environment-fetcher is a newly introduced bug, should be fixed with this issue - https://youtrack.jetbrains.com/issue/TW-87170/teamcity-process-environment-fetcher-plugin-corrupted-jar-reported-by-TeamCity.Node-plugin , please also see the comments there.