Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOENT: no such file or directory, open 'C:\projectpath\@tsconfig\node16\tsconfig.json #46

Open
neckaros opened this issue May 17, 2023 · 4 comments

Comments

@neckaros
Copy link

neckaros commented May 17, 2023

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
@jonkwheeler
Copy link
Owner

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

@neckaros
Copy link
Author

Yes it's definitely not in "@tsconfig\node16\tsconfig.json" I don't know where it gots those folders that does not exist

@jonkwheeler
Copy link
Owner

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?

@neckaros
Copy link
Author

neckaros commented May 19, 2023

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: microsoft/TypeScript#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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants