SonarCloudAnalyze Azure Dev Ops Error: ENOENT: no such file or directory, open

Hello,

Recently the SonarCloudAnalyze analyze azure dev ops tasks started producing this error message for some of the html files in my project.

INFO: Sensor JavaScript inside HTML analysis [javascript]
INFO: 2 source files to be analyzed
##[error]ERROR: Error: ENOENT: no such file or directory, open 'C:\...\index.html'
ERROR: Error: ENOENT: no such file or directory, open 'C:\...\index.html'
##[error]ERROR: Error: ENOENT: no such file or directory, open 'C:\...\index.html'

1 Like

We use SonarCloud. We are seeing the same issue on our end. All our .net projects that build on windows Jenkins are failing with html files not found. It’s odd that the scan gets published to SonarCloud(eliminating any credential issue connecting from Jenkins to SonarCloud). I think it is failing the quality gate step, which happens after the analyze.

ERROR: Error: ENOENT: no such file or directory, open

Did something get pushed from SonarCloud that would be causing this or anything we can try to get around this issue because it is affecting many projects?

Same issue here using Azure DevOps with SonarCloud:

INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [E:\Agents\a1\_work\3\s\myProject\ClientApp\tsconfig.json]
INFO: 252 source files to be analyzed
INFO: Creating TypeScript program
INFO: TypeScript configuration file E:\Agents\a1\_work\3\s\myProject\ClientApp\tsconfig.json
INFO: Creating TypeScript program (done) | time=3466ms
INFO: Starting analysis with current program
INFO: 45/252 files analyzed, current file: E:/Agents/a1/_work/3/s/myProject/ClientApp/src/app/shared/models/Recipes.ts
INFO: Analyzed 252 file(s) with current program
INFO: 252/252 source files have been analyzed
INFO: Hit the cache for 0 out of 252
INFO: Miss the cache for 252 out of 252: ANALYSIS_MODE_INELIGIBLE [252/252]
INFO: Sensor TypeScript analysis [javascript] (done) | time=29570ms
INFO: Sensor JavaScript inside HTML analysis [javascript]
INFO: 148 source files to be analyzed
##[error]ERROR: Error: ENOENT: no such file or directory, open 'E:\Agents\a1\_work\3\myProject\ClientApp\src\app\rt\rt-aspo\rt-aspo.component.html'
ERROR: Error: ENOENT: no such file or directory, open 'E:\Agents\a1\_work\3\myProject\ClientApp\src\app\rt\rt-aspo\rt-aspo.component.html'

The “JavaScript inside HTML analysis” Sensor is using a wrong path:
'E:\Agents\a1_work\3\myProject'
The correct one should be:
'E:\Agents\a1_work\3\s\myProject'
because 's' is the source root folder of the Git repository inside the Azure Pipelines agent.

The other sensors are working correctly :thinking:

1 Like

Hello,

Thank you for bringing up this issue. We are looking into ways to reproduce this.

Would you be open to sharing more information about your setup?

  • the sonar.properties file
  • any additional log lines that might be relevant

We have indeed released the support for analyzing JavaScript code embedded into HTML files which seems to be resolving paths incorrectly.

Best Regards,
Ilia

I am using the azure dev ops tasks provided by sonar cloud. Task definitions from my yaml build file are below.

  - task: SonarCloudPrepare@1
    inputs:
      SonarCloud: 'My Org SonarCloud'
      organization: 'myorg'
      scannerMode: 'MSBuild'
      projectKey: 'my_project_key'
      projectName: 'My Project Name'
      extraProperties: 'sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/coverage.opencover.xml'

The sonar cloud analyze and publish tasks are using the default settings.

This error seems to happen when analyzing html files inside a blazor wasm csproj. But I don’t think there is anything blazor specific here seems like it is just choking on raw html files. Let me know if you need any other information.

Hello all,

thanks for reporting this issue. We’ve found the problem and we are preparing a bugfix release. We’ll let you know when it’s deployed in SonarCloud in the coming days.

Cheers,
Victor

2 Likes

Great! Thanks for the quick response and fix.

I am facing the same issue. Is the fix pushed to sonarcloud?

Hello,

We encounter the same problem with an angular app and *.component.html files in an Azure pipeline.
Looking forward for a fixed version.

Regards
David

Hey all.

There should be a fixed version deployed early this week (the fix is merged, we just need a deployment).

Thanks Colin for the update.

I am also facing the same issue. Could you please let us know once the fix is deployed and what changes needs to be done from our end too to fix this issue.

Thanks,
Sai.

Hello all,

fix should be now deployed in SonarCloud.

Please let us know in case you still see this error.

Cheers,
Victor

1 Like

Seems to work, no more errors. I will try it with some more pipelines tomorrow.

Thank you.

1 Like

Hi, it works also for me, no more error:

INFO: Sensor JavaScript inside HTML analysis [javascript]
INFO: 148 source files to be analyzed
INFO: 148/148 source files have been analyzed
INFO: Hit the cache for 0 out of 148
INFO: Miss the cache for 148 out of 148: ANALYSIS_MODE_INELIGIBLE [148/148]
INFO: Sensor JavaScript inside HTML analysis [javascript] (done) | time=890ms

Thank you!

1 Like