SonarTS unable to start - Node not found

  • Version:
    SonarLint 4.6
    Typesciprt: 3.7.5
    Node: 12.16.2

  • Error observed: Cannot find the node binary to detect the node version.

Failed to start SonarTS Server
java.io.IOException: Cannot run program "node": error=2, No such file or directory
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at org.sonar.plugin.typescript.ContextualServer.startSonarTSServer(ContextualServer.java:114)
	at org.sonar.plugin.typescript.ContextualServer.start(ContextualServer.java:92)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
	at org.sonarsource.sonarlint.core.container.ComponentContainer$1.start(ComponentContainer.java:271)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.sonarsource.sonarlint.shaded.org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:124)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainer.doAfterStart(StorageContainer.java:126)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.start(ConnectedSonarLintEngineImpl.java:118)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.<init>(ConnectedSonarLintEngineImpl.java:77)
	at org.sonarlint.intellij.core.SonarLintEngineFactory.createEngine(SonarLintEngineFactory.java:88)
	at org.sonarlint.intellij.core.SonarLintEngineManager.getConnectedEngine(SonarLintEngineManager.java:110)
	at org.sonarlint.intellij.core.SonarLintEngineManager.getConnectedEngine(SonarLintEngineManager.java:134)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:73)
	at org.sonarlint.intellij.core.ProjectBindingManager.getFacade(ProjectBindingManager.java:61)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.isExcludedInServer(AutoTriggerStatusPanel.java:141)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.getCard(AutoTriggerStatusPanel.java:130)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.switchCards(AutoTriggerStatusPanel.java:107)
	at org.sonarlint.intellij.ui.AutoTriggerStatusPanel.<init>(AutoTriggerStatusPanel.java:81)
	at org.sonarlint.intellij.ui.SonarLintIssuesPanel.<init>(SonarLintIssuesPanel.java:55)
	at org.sonarlint.intellij.ui.SonarLintToolWindowFactory.addIssuesTab(SonarLintToolWindowFactory.java:53)
	at org.sonarlint.intellij.ui.SonarLintToolWindowFactory.createToolWindowContent(SonarLintToolWindowFactory.java:43)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.createContentIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:493)
	at com.intellij.openapi.wm.impl.ToolWindowImpl.scheduleContentInitializationIfNeeded$intellij_platform_ide_impl(ToolWindowImpl.kt:473)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doShowWindow(ToolWindowManagerImpl.kt:918)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.showToolWindowImpl(ToolWindowManagerImpl.kt:864)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.doRegisterToolWindow(ToolWindowManagerImpl.kt:990)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.initToolWindows(ToolWindowManagerImpl.kt:446)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.access$initToolWindows(ToolWindowManagerImpl.kt:90)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl$beforeProjectOpened$2.run(ToolWindowManagerImpl.kt:427)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:310)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
	at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:728)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
	at com.intellij.cloudConfig.CloudConfigManager.waitDone(CloudConfigManager.java:1890)
	at com.intellij.cloudConfig.CloudConfigManager.getRepositoryPlugins(CloudConfigManager.java:1874)
	at com.intellij.cloudConfig.CloudConfigManager.updatePlugins(CloudConfigManager.java:1949)
	at com.intellij.cloudConfig.CloudConfigManager.safeUpdatePlugins(CloudConfigManager.java:1899)
	at com.intellij.cloudConfig.CloudConfigManager.lambda$doConnection$22(CloudConfigManager.java:1043)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:201)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:310)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:80)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:128)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:46)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:184)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:974)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:847)
	at com.intellij.ide.IdeEventQueue.lambda$null$8(IdeEventQueue.java:449)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:739)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:496)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 95 more

Workaround: Start IntelliJ with sudo.

1 Like

Hi,

Are you on Mac or Linux? Is there any restriction on your IntelliJ process to access your node installation?

I had the same problem.
I am on Mac.
What do you mean by restriction?
I have admin rights on my user.
The workaround works.

I am running on Mac. There are no restrictions, I installed The Toolbox normally and installed IntelliJ Ultimate through it.

@tenoriojuann: according to your other thread (about TypeScript not being found), this issue might also be due to the (old) version of the TypeScript analyzer that you use - recent versions of the analyzer rely upon the run-node library to find the Node runtime on macOS.

@vipirain: are you using the connected mode, and if so what is the version of the TypeScript analyzer on your SonarQube server?

Yes, connected mode.
SonarTS 1.9.0.3766

Thanks for the confirmation.

I would strongly advise that you update the version of the JavaScript and TypeScript analyzers on your SonarQube server, if possible: there were a lot of fixes and improvements in this past year :slight_smile:

If not, one possible workaround is to make sure that your IDE is started with the node executable somewhere in the PATH environment variable, e.g by starting it from a terminal that has the correct environment, modifying IntelliJ’s start script or using your own script.

Same problem here, but I have configured node executable on intellij settings:

permissions are ok: -rwxr-xr-x 1 dgarcia@xxx xxx 34913326 sep 10 2018 node*

the plugin should take it from here, isn’t it?

Hello, thanks for your message.

Unfortunately, this is not the case. The JavaScript/TypeScript analyzer embedded by SonarLint will try to run the node executable:

  • either from the sonar.nodejs.executable property (see Settings > Tools > SonarLint > Project Settings)
  • or directly from the PATH environment variable

Using the one set in the “Node.js and NPM” settings could be a nice UX improvement; however it would be only available when the Node.js integration plugin is installed, which is not necessarily the case.

For the record, I created a ticket to see if we could take benefit of the “Node.js and NPM” setting:
https://jira.sonarsource.com/browse/SLI-404

1 Like