NodeJS Plugin NullPointerException

Article ID:360029885191
1 minute readKnowledge base

Issue

After upgrading to NodeJS Plugin version 1.3.0, jobs will start to fail with this stacktrace:

java.lang.NullPointerException
  at jenkins.plugins.nodejs.NodeJSBuildWrapper.setUp(NodeJSBuildWrapper.java:166)
  at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146)
  at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:667)
  at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
  at hudson.model.Run.execute(Run.java:1818)
  at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
  at hudson.model.ResourceController.execute(ResourceController.java:97)
  at hudson.model.Executor.run(Executor.java:429)

The plugin introduced cache locator strategy and also guarantees that cache locator strategy cannot be null both after calling the constructor and calling the appropriate setter method. But that applies only if we create a new job or change the configuration for nodejs for an existing job, using nodejs-plugin 1.3.0. But if you have an existing job, which was created before nodejs-plugin 1.3.0, it is missing the configuration for cache locator strategy.

This will affect all jobs using this plugin after upgrade to 1.3.0.

Resolution

A fix for this issue was released as NodeJS Plugin version 1.3.1.

Workaround

Open up the job configuration for an effected job, save the configuration again to force the update of the cache location strategy.

New jobs are not affected by this.

Tested product/plugin versions

References

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.