Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nodejs from options from NetBeans itself #17

Closed
Chris2011 opened this issue Aug 31, 2021 · 10 comments
Closed

Use nodejs from options from NetBeans itself #17

Chris2011 opened this issue Aug 31, 2021 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Chris2011
Copy link

I saw, that the analyzer for Javascript is disabled because of this error:

Disable: UnsatisfiedRuntimeRequirement [runtime=NODEJS, currentVersion=null, minVersion=10.12.0]

I didn't understand why because node is installed and also nodejs executable is set via options from the official node.js module:

image

After clicking through your plugin options, I saw that there is an extra options node in SonarLint and I see that I need to set the nodejs executable manual. So my suggestion is, please use the path from within NetBeans, because it was already set. No need to set it again. If there was no nodejs set, it needs to be set in the options, that you see in the screenshot.

@philippefichet
Copy link
Owner

Thanks for you feedback.
There are two point for this issue:
1/ I don't know how use nodejs configuration from html netbeans plugin. I want this plugin work without that html plugin may required and I must search how to read this configuration optionally (help are welcome :) ), but I have no time actually.
2/ If nodejs configuration for sonarlint4netbeans plugin is missing, also sonar-javascript-plugin search automatically nodejs like this : https://github.com/SonarSource/SonarJS/blob/0bc41c5ccaf14ec4a8a543d739cb602f6e40f42d/nodejs-utils/src/main/java/org/sonarsource/nodejs/NodeCommandBuilderImpl.java#L248.
I know this is not the best solution but is more speed to fix this

I keep this issue open to realize this later, thanks again for your feedback ;)

@Chris2011
Copy link
Author

Thx for the info. I use node for my other plugins so there is no problem. For part two, the search seems not work properly. As I said, I got this error from your plugin:

Disable: UnsatisfiedRuntimeRequirement [runtime=NODEJS, currentVersion=null, minVersion=10.12.0]

So that means, that It can't find my node.exe but when I call "where" in my CLI it gives me the path.

@philippefichet
Copy link
Owner

OK thanks.
I think that it is really a bug.
I try to fix it later.
Thanks again

@philippefichet philippefichet added the bug Something isn't working label Sep 2, 2021
@Chris2011
Copy link
Author

Great. Thx. Will also try to work on your plugin sooner or later :).

@philippefichet philippefichet added this to the 2.5.0 milestone Sep 25, 2021
@philippefichet
Copy link
Owner

Hi @Chris2011,
I had some time to understand better what was going on.
In fact, the verification of the NodeJS version required by the plugin is done in "PluginInfoLoader" through the configuration passed to the engine by my plugin.
I was mistaken in thinking that the automatic search of "NodeCommandBuilderImpl" was used.
"NodeCommandBuilderImpl" being in the "nodejs-utils" artifact, to see if it is possible to use it too.

@Chris2011
Copy link
Author

Cool @philippefichet thx for the info :)

@philippefichet
Copy link
Owner

I created a patch to use the default nodejs path (like NodeCommandBuilderImpl) in the "fix-default-nodejs-path" branch.
But I don't use the netbeans html plugin configuration.
Can you try on your side if it works well?

@Chris2011
Copy link
Author

I tested it and when I open a JS file, the analyzer is working w/o the need to set the options. Now is the question, why we still need the options section to set node? If you use the nodejs from NetBeans, you should show it on the page and when I want to change it, that would be possible anyway. But this is just guessing, I dunno exactly, whether the section is now obsoleted or not. Thx for the fix :)

@philippefichet
Copy link
Owner

The options section can be used to define another version of nodeJS that might be required by one of the analyzers.
On Ubuntu 20.04 LTS, the nodejs version is version 10 (https://packages.ubuntu.com/focal/nodejs), but it is recommended to use version 12, 14 or 16 for the Javascript analyzer.
I do not use the nodejs of the NetBeans HTML plugin. If I use the NetBeans HTML plugin nodejs in the future (the idea is good and again thank you for that, but complex at my level to implement, I will create another issue for that), I think the option will still be useful in the future because the nodejs required for HTML could be different from that required by the analyzers.
Thanks again for your feedback :).

@philippefichet
Copy link
Owner

I close this issue because next step is in #23 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants