Nuxt 3 Project: Error: Cannot read file '/home/vsts/work/1/s/.nuxt/tsconfig.json'

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension): SonarQubeAnalyze v5.10.0
  • what are you trying to achieve: Running the pipeline in Azure DevOps
  • what have you tried so far to achieve this: 3.0.0 Excluding .nuxt folder in the file

We have a project using Nuxt version 3.0.0, when it’s running in our Azure Devops Pipeline we have the following errors everytime:

INFO: Sensor JavaScript analysis [javascript] (done) | time=7940ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Found 1 tsconfig.json file(s): [/home/vsts/work/1/s/tsconfig.json]
INFO: Creating TypeScript program
INFO: TypeScript configuration file /home/vsts/work/1/s/tsconfig.json
INFO: 18 source files to be analyzed
##[error]ERROR: Error: Cannot read file '/home/vsts/work/1/s/.nuxt/tsconfig.json'.
ERROR:     at createProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/programManager.js:65:15)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/server.js:36:61
ERROR:     at Layer.handle [as handle_request] (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at next (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:137:13)
ERROR:     at Route.dispatch (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:112:3)
ERROR:     at Layer.handle [as handle_request] (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:281:22
ERROR:     at Function.process_params (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:341:12)
ERROR:     at next (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:275:10)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/body-parser/lib/read.js:130:5
ERROR: Error: Cannot read file '/home/vsts/work/1/s/.nuxt/tsconfig.json'.
ERROR:     at createProgram (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/programManager.js:65:15)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/lib/server.js:36:61
ERROR:     at Layer.handle [as handle_request] (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at next (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:137:13)
ERROR:     at Route.dispatch (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/route.js:112:3)
ERROR:     at Layer.handle [as handle_request] (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/layer.js:95:5)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:281:22
ERROR:     at Function.process_params (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:341:12)
ERROR:     at next (/home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/express/lib/router/index.js:275:10)
ERROR:     at /home/vsts/work/1/s/.scannerwork/.sonartmp/eslint-bridge-bundle/package/node_modules/body-parser/lib/read.js:130:5
##[error]ERROR: Failed to create program: Cannot read file '/home/vsts/work/1/s/.nuxt/tsconfig.json'.
ERROR: Failed to create program: Cannot read file '/home/vsts/work/1/s/.nuxt/tsconfig.json'.
INFO: Creating TypeScript program (done) | time=14ms
INFO: Skipped 18 file(s) because they were not part of any tsconfig (enable debug logs to see the full list)
INFO: 18/18 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=215ms

Hi,

What’s your version of SonarQube? You can find it in the page footer.

Also, I want to double-check with you the difference between

and

Any idea where that .nuxt came from?

 
Ann

Hi,

Thanks for your reply.

The version of SonarQube is Enterprise EditionVersion 9.4 (build 54424).
Concerning the two tsconfig.json:

  • The first one /home/vsts/work/1/s/tsconfig.json is at the root project, it basically extends the config from the one from .nuxt
  • The second one /home/vsts/work/1/s/.nuxt/tsconfig.json is the one used by Nuxt framework that comes by default.

.nuxt folder is used for development only, it’s re-created every time you run nuxt dev (More information here). I’m not sure why it’s generated in the SonarQubeAnalyze pipeline

Hi,

SonarQube 9.4 has some age on it at this point. The current version is 9.8 (with 9.9 LTS due out on the 7th). Can you upgrade and see if this is replicable? Also, can you verify that the user running analysis has permissions to all files in the analysis directory, recursive?

 
Ann

Hi,
Thanks I will get in touch with the department in my company managing SonarQube.
I will let you know after upgrading if it works

Same problem with version 10

Hi @Gabriel_Alvarez,

Welcome to the community!

Can you upgrade to the current version, 10.2.1 (10.3 imminent) and try again?

 
Ann

I can’t I’llwait for my company upgrade