Cannot make work SonarQube for javascript project

Hello,

Im using SonarQube:

Developer edition version 9.1.0.47736
On Windows 10 with Visual Studio 2019 e net core 3.1 , net framework 4.5

My project contains a web app ui written in javascript using vue js. Im triyng to make SonarQube analisys on this part.

So i make these steps:

  1. installed sonar scanner
    npm install --save-dev sonarqube-scanner

  2. Create sonar-project.js
    const sonarqubeScanner = require(‘sonarqube-scanner’);

sonarqubeScanner(
  {
    serverUrl: process.env.SONAR_SERVER || 'http://myserver:9000',
    token: process.env.SONAR_TOKEN || 'token',
    options: {}
  },
  () => process.exit()
);
  1. Create sonar-project.properties
    sonar.projectKey=MyName
    sonar.projectName=MyName
    sonar.projectVersion=1.0
    sonar.language=js
    sonar.sources=src
    sonar.sourceEncoding=UTF-8

then i have tried to lanch this command:
node sonar-project.js
in folder of my project.
and i get Error: Cannot find module ‘sonarqube-scanner’

I dont know if all steps are right or if I did something wrong.

Thanks for support

Hey there.

The npm sonarqube-scanner package is a third-party integration that isn’t built by Sonar. I’d suggest raising an issue on their Github repository: GitHub - bellingard/sonar-scanner-npm: SonarQube Scanner for the JavaScript world, or simply running a plain SonarScanner CLI analysis.

Hello,

thanks for reply, are there any alternatives to using this third party tool using sonarqube directly?

You can just launch the SonarScanner CLI from the directory where your code is stored, and Javascript analysis will take place!

Integrations exist for many CI Tools as well.