Search code examples
node.jstypescriptdocker-composedockerfile

error TS5083: Cannot read file '/tsconfig.json'


I am trying to run the command "tsc --build" when running "docker compose up --build" so it can run that command when creating the Docker container.

The thing is I am getting always an error:

enter image description here

I have been reading about it and I am not importing in my code anything outside the "rootdir"... so I have no idea why those packages are there...

I am not sure if removing the rootdir option from tsconfig file is a good idea or it would cause an error afterwards in my app...

Any ideas?


Solution

  • This is an alternative solution I found. I switched to esbuild and resolved my error.

    You can use yarn add -D esbuild esbuild-runner and you can then update your build command accordingly in package.json and dockerfile