ENOENT: no such file or directory, open 'C:\projectpath\@tsconfig\node16\tsconfig.json
When running i get an error with this module trying to get a tsconfig at an odd path. I tried putting absolute path for the --project to no avail
tsc -p tsconfig.json && tsconfig-replace-paths -v --project tsconfig.json
Using tsconfig: C:\_projectpath_\tsconfig.json
node:internal/fs/utils:348
throw err;
^
Error: ENOENT: no such file or directory, open 'C:\_projectpath_\@tsconfig\node16\tsconfig.json'
at Object.openSync (node:fs:599:3)
at Object.readFileSync (node:fs:467:35)
at loadConfig (C:\_projectpath_\node_modules\tsconfig-replace-paths\dist\commonjs\util.js:16:28)
at loadConfig (C:\_projectpath_\node_modules\tsconfig-replace-paths\dist\commonjs\util.js:49:53)
at Object.<anonymous> (C:\_projectpath_\node_modules\tsconfig-replace-paths\dist\commonjs\index.js:41:48)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: 'C:\\_projectpath_\\@tsconfig\\node16\\tsconfig.json'
}
Node.js v18.7.0
Something with @tsconfig is throwing it off I'm guessing?
Your tsconfig.json should be at the root and not @tsconfig\node16\tsconfig.json since your script says tsc -p tsconfig.json && tsconfig-replace-paths -v --project tsconfig.json
Yes it's definitely not in "@tsconfig\node16\tsconfig.json" I don't know where it gots those folders that does not exist
That's really weird. Something in your project is telling it to use a tsconfig that does not exist.
What does tsc -p ./tsconfig.json do?
It works well but i think i found the issue. I forgot that my tsconfig is extending and existing one (from my bootstrap):
{
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
...
tsc and VSCode (when I ctrl+click on the path) successfully locate it but it's in fact under the node_modules directory: "...\node_modules@tsconfig\node16\tsconfig.json"
i think both VSCode and tsconfig also look in node_modules directory but not your code. (did a little search and found the commit: https://github.com/microsoft/TypeScript/issues/18865)
I changed path to:
{
"extends": "./node_modules/@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"target": "ES2020",
and it's working
I'm not closing this issue myself letting you decide if you want to close or adapt to this specific case
And thanks for taking the time to help!