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

tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found #2085

Closed
sammo opened this issue Jun 6, 2024 · 43 comments
Assignees
Labels
bug Something isn't working

Comments

@sammo
Copy link

sammo commented Jun 6, 2024

Hi -

I'm trying to start a new wasp project but running into this error on wasp db migrate-dev command.

Do you know what the issue could be?

✅ --- Database successfully set up. ----------------------------------------------

🐝 --- Building SDK... ------------------------------------------------------------

[ Wasp ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[ Wasp ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[ Wasp ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[ Wasp ] There are types at '.../mySaasApp/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

❌ --- [Error] Your wasp project failed to compile: -------------------------------

  • SDK build failed with exit code: 2

❌ --- [Error] Compilation of wasp project failed: --------------------------------

1 errors found

@Martinsos
Copy link
Member

Martinsos commented Jun 6, 2024

Edit: see how to solve this here: #2085 (comment)


@sammo this seems quite weird!

It could help if you could provide following info: your OS, wasp version, node version, how did you start the project (I guess from open-saas? Doing wasp new -t saas?).

In the meantime, pls try running wasp clean and see if that helps -> if it does, let us know.

@sammo
Copy link
Author

sammo commented Jun 6, 2024

@Martinsos thanks for the quick reply.
I'm using

  • ubuntu 24.04
  • wasp 0.13.2
  • node 18.9.1

I started the project by running these commands:

curl -sSL https://get.wasp-lang.dev/installer.sh | sh
wasp new mySaasApp -t todo-ts

I'll wasp clean

@sammo
Copy link
Author

sammo commented Jun 6, 2024

@Martinsos I just ran wasp new -t saas and it worked!

Thank you for the help.

@sammo sammo closed this as completed Jun 6, 2024
@Martinsos
Copy link
Member

Martinsos commented Jun 6, 2024

Great @sammo ! I am still curious what caused the initial issue, do you have any idea? How did you create the project first time?

EDIT: Sorry, I missed the message above, I see now how you started the project!
It is important to notice that you started Wasp from different template now -> saas is much richer than todo-ts. However, todo-ts should also work!

Would you mind trying creating project with wasp new myTodoApp -t todo-ts and seeing if you get the error again or if it is again? If it happens again, we will make sure to look deeper into it. I did try it just to be sure on my machine right now, but it works for my setup at the moment, for todo-ts.

@sammo
Copy link
Author

sammo commented Jun 6, 2024

@Martinsos I found out from my .zsh_history this error was raised by wasp db migrate-dev

That's how I replicated it

wasp new mySaasApp2 -t todo-ts
cd mySaasApp2
wasp db migrate-dev

And I got this error

🐝 --- Compiling wasp project... --------------------------------------------------

[  Wasp  ] Starting npm install
[  Wasp  ] Still installing npm dependencies!
[  Wasp  ] Installation going great - we'll get there soon!
[  Wasp !] npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
[  Wasp !] npm WARN deprecated [email protected]: Use your platform's native DOMException instead
[  Wasp  ] 
[  Wasp  ] added 462 packages, and audited 463 packages in 18s
[  Wasp  ] 
[  Wasp  ] 101 packages are looking for funding
[  Wasp  ]   run `npm fund` for details
[  Wasp  ] 
[  Wasp  ] 2 moderate severity vulnerabilities
[  Wasp  ] 
[  Wasp  ] Some issues need review, and may require choosing
[  Wasp  ] a different dependency.
[  Wasp  ] 
[  Wasp  ] Run `npm audit` for details.
[ Client ] Starting npm install
[ Server ] Starting npm install
[ Client ] 
[ Client ] added 117 packages, and audited 118 packages in 3s
[ Client ] 
[ Client ] 14 packages are looking for funding
[ Client ]   run `npm fund` for details
[ Client ] 
[ Client ] found 0 vulnerabilities
[ Server ] Still installing npm dependencies!
[ Server!] npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[ Server!] npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
[ Server!] npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
[ Server ] 
[ Server ] added 372 packages, and audited 373 packages in 6s
[ Server ] 
[ Server ] 121 packages are looking for funding
[ Server ]   run `npm fund` for details
[ Server ] 
[ Server ] 4 moderate severity vulnerabilities
[ Server ] 
[ Server ] To address all issues (including breaking changes), run:
[ Server ]   npm audit fix --force
[ Server ] 
[ Server ] Run `npm audit` for details.
✅ --- Successfully completed npm install. ----------------------------------------


🐝 --- Setting up database... -----------------------------------------------------


[   Db  !] Error: P1003
[   Db  !] 
[   Db  !] Database dev.db does not exist at /.../mySaasApp2/.wasp/out/db/./dev.db
[   Db  !] 
[   Db   ] Environment variables loaded from .env
[   Db   ] Prisma schema loaded from ../db/schema.prisma
[   Db   ] 
[   Db   ] ✔ Generated Prisma Client (4.16.2 | library) to ./../../../node_modules/@prisma/client in 63ms
[   Db   ] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[   Db   ] ```
[   Db   ] import { PrismaClient } from '@prisma/client'
[   Db   ] const prisma = new PrismaClient()
[   Db   ] ```
✅ --- Database successfully set up. ----------------------------------------------


🐝 --- Building SDK... ------------------------------------------------------------


[  Wasp  ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[  Wasp  ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[  Wasp  ]   There are types at '/.../mySaasApp2/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

❌ --- [Error] Your wasp project failed to compile: -------------------------------

- SDK build failed with exit code: 2


❌ --- [Error] Compilation of wasp project failed: --------------------------------

1 errors found

@Martinsos
Copy link
Member

Awesome thanks! Just to confirm, this are not logs from the first time, you actually managed to replicate this again?

I wonder if this has something to do with node 18 hm, we will be looking into it.

@Martinsos Martinsos reopened this Jun 6, 2024
@Martinsos Martinsos added the bug Something isn't working label Jun 6, 2024
@Martinsos Martinsos transferred this issue from wasp-lang/open-saas Jun 6, 2024
@Martinsos
Copy link
Member

Martinsos commented Jun 10, 2024

One more user reported the same issue: wasp-lang/open-saas#173 .

@aliammari1, it could help if you could provide following info: your OS, wasp version, node version, how did you start the project (open saas? specific template? Mage?).

In the meantime, pls try running wasp clean and see if that helps -> if it does, let us know.

@Martinsos
Copy link
Member

Martinsos commented Jun 10, 2024

And here is the third report: #2091 !

Super short info from it:

OS: Linux 6.1.0-21-amd64 Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux
Browser: chrome
Version: chrome 125.0.6422.141
Wasp: 0.13.2
Node v18.19.0

wasp clean didn't help them.


Interesting data so far is:

  1. Both reports are from Ubuntu (we don't know about thrid report yet).
  2. Error is mentioning node18 and two of the users reported using node 18.

I this this is very likely connected to node 18, not sure how yet or why it started happening now. Ubuntu is probably not the cause, but probably the "delivery method", in the sense that the users are using a version of Ubuntu that comes with node 18 by default.

@Martinsos
Copy link
Member

@grsh50 , could you please try switching to node 20 (e.g. using nvm) and try running Wasp again?

@aliammari1 which node version are you using? If you are using 18, could you also try switching to 20 and tell us if that helps?

@grsh50
Copy link

grsh50 commented Jun 10, 2024

grosh@buh:~/Documents/src/repo/newWasp/myTodoApp$ wasp db migrate-dev

🐝 --- Compiling wasp project... --------------------------------------------------


✅ --- Successfully completed npm install. ----------------------------------------


🐝 --- Setting up database... -----------------------------------------------------


[   Db  !] Error: P1003
[   Db  !] 
[   Db  !] Database dev.db does not exist at /home/grosh/Documents/src/repo/newWasp/myTodoApp/.wasp/out/db/./dev.db
[   Db  !] 
✅ --- Database successfully set up. ----------------------------------------------


🐝 --- Building SDK... ------------------------------------------------------------


[  Wasp  ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[  Wasp  ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[  Wasp  ]   There are types at '/home/grosh/Documents/src/repo/newWasp/myTodoApp/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

❌ --- [Error] Your wasp project failed to compile: -------------------------------

- SDK build failed with exit code: 2


❌ --- [Error] Compilation of wasp project failed: --------------------------------

1 errors found
grosh@buh:~/Documents/src/repo/newWasp/myTodoApp$ node --version
v20.14.0

@Martinsos
Copy link
Member

Ok so it also happens with node 20, didn't expect that! Thanks, we will be looking into this in the following days and will be posting updates here!

@Martinsos
Copy link
Member

Note for devs: we currently always go with @tsconfig/node18, even if people use node 20 or later, because we have this 18 currently on th lower limit for what Wasp supports. In the future we will be basing it on engines in package.json.

@Martinsos
Copy link
Member

Note for devs: I tried replicating this on my machine but failed, all works so far. Specifically, I reinstalled latest version of Wasp and ran wasp new MyTestApp -t todo-ts and then wasp db migrate-dev. I also tried cleaning the whole npm cache with npm cache clean --force to simulate a more "fresher" situation, but that also didn't help, it still works.
I did this first test with node 20, I tried doing it also with node 18.19 but also couldn't replicate. This is on Arch Linux.

@aliammari1
Copy link

@grsh50 , could you please try switching to node 20 (e.g. using nvm) and try running Wasp again?

@aliammari1 which node version are you using? If you are using 18, could you also try switching to 20 and tell us if that helps?

thank you sir, the problem was my node version. I updated it from 18 to 20 and it worked

@Martinsos
Copy link
Member

@grsh50 , could you please try switching to node 20 (e.g. using nvm) and try running Wasp again?
@aliammari1 which node version are you using? If you are using 18, could you also try switching to 20 and tell us if that helps?

thank you sir, the problem was my node version. I updated it from 18 to 20 and it worked

Thanks for letting me know!

This does make things even more complex though hah, because one user got it fixed by installing another template, while one user fixed it with using another node version, and finally none of these helped third user! Hm. Almost sounds like it is getting fixed randomly.

@grsh50
Copy link

grsh50 commented Jun 11, 2024

Thank you for your support! :)

I ran wasp new todo -t todo-ts, and it worked.

This time, compiling the Wasp project took longer, but the SDK build was almost instant.

Could the issue be related to the Node version used to create the new project?
The previous logs were from a project created on Node 18.19, and only the wasp db migrate-dev command was executed on Node 20.14.

Update:
The MAGE app now runs.

@Martinsos
Copy link
Member

Thank you for your support! :)

I ran wasp new todo -t todo-ts, and it worked.

This time, compiling the Wasp project took longer, but the SDK build was almost instant.

Could the issue be related to the Node version used to create the new project? The previous logs were from a project created on Node 18.19, and only the wasp db migrate-dev command was executed on Node 20.14.

Update: The MAGE app now runs.

Oh that's an interesting hypothesis indeed!

AHa, wait, now even the older app runs? Ok, now we have no idea again what is causing this :D.

Is there any way you can replicate the initial problem again? For example going to node 18 again, and trying to run that Mage app, or maybe new app based on todo-ts?

@sammo above managed to replicate it doing wasp new MyCoolApp -t todo-ts with node 18, if you can also do that consistently, that gives us something solid to work from.

@Martinsos Martinsos changed the title wasp db migrate-dev throws an error tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found Jun 13, 2024
@Martinsos
Copy link
Member

One more report: https://discord.com/channels/686873244791210014/1250815248395669504/1250815248395669504 .

User was using node 18, but new data point is that they managed to fix it by adding

 "devDependencies": {
    "@tsconfig/node18": "latest",

to their package.json.

What also worked was switching to node 20, then that dev dependency was not needed, same like other users.

@grsh50
Copy link

grsh50 commented Jun 13, 2024

I ran some test builds with todo's and saas templates on node versions 18.19.0 and 18.19.1 and everything works fine.

Update:
I tried the case I mentioned earlier - changing the node version after creating the template.
Everything works fine.

$ node --version
v18.19.0
$ wasp new
$ nvm use 20.14.0
$ wasp db start
$ wasp db migrate-dev

@Martinsos
Copy link
Member

I ran some test builds with todo's and saas templates on node versions 18.19.0 and 18.19.1 and everything works fine.

Ah come on :)! I am kidding, thanks a lot, but am still surprised by inconsistency of this bug. Still, we will figure it out, one way or another!

@infomiho
Copy link
Contributor

This is the only similar issue I found while searching around the internet: TypeStrong/ts-node#2076

It seems to be related to ts-node which jest uses under the hood to resolve the tsconfig.json. This was caused by some internal API changes in TS 5.2+ version. I'm really not sure if we have similar issues as reported there. I've tested also on Ubuntu with Node 18 and couldn't reproduce it.

@Martinsos
Copy link
Member

This is the only similar issue I found while searching around the internet: TypeStrong/ts-node#2076

It seems to be related to ts-node which jest uses under the hood to resolve the tsconfig.json. This was caused by some internal API changes in TS 5.2+ version. I'm really not sure if we have similar issues as reported there. I've tested also on Ubuntu with Node 18 and couldn't reproduce it.

It being triggered by changes in TS version makes sense, as it started happened suddenly, that is very likely the cause! We need to pin down that TS version tighter.

I would still like to better understand the exact thing that happens, but I think we have a good bet what is the cause now.

@sodic sodic self-assigned this Jul 2, 2024
@sodic
Copy link
Contributor

sodic commented Jul 2, 2024

It seems to be related to ts-node which jest uses under the hood to resolve the tsconfig.json.

That's not it (at least I think it isn't). ts-node is nowhere to be found in node_modules. From what I see, Jest isn't using it.

@infomiho What made you think we were using ts-node?
If it was this comment, it was probably a misunderstanding - the comment talks about Jest TS configuration files (not tsconfig.json files).

Regardless, I tried installing ts-node both globally and in the repo, with the hopes of jest using it if it's available, but no luck. Unless I missed something, I think it's safe to say this isn't related to ts-node.

I'll now try reproducing it with different versions of TypeScript.

@sodic
Copy link
Contributor

sodic commented Jul 3, 2024

Next time this happens, we should ask our users for a zip of their projects (or at least their package.json and package-lock.json files).

@Martinsos
Copy link
Member

@sodic it is not any kind of special projects though, they say above they merely had it happen on creating a new Wasp project from the template. So maybe package-lock.json files would offer something unique for their installation, but the rest, including package.json, shouldn't be anything unique. Notice that even if they share their package-lock.json, it still won't capture what was installed for the purposes of the framework code (or will it?).

@Martinsos
Copy link
Member

Some quick analysis of information we have so far:

  • OS: Ubuntu, Debian, unknown, unknown
  • everybody had the issue due to creating a Wasp project with node 18.
  • different fixes that worked for people:
    • wasp clean && wasp new -t saas while staying on node 18
    • switching to node 20 and running the project again
    • creating project again with node 20 and then running it
    • adding tsconfig/node18 directly to package.json as a dev dep
  • once things get working for people, they continue working

It seems that there is a situation, when using node 18, that results in tsconfig/node18 not getting installed, and then stuff fails. And it seems that to get out of it, you need to shake things up a bit, and the most efficient way is to switch to node 20, but it seems like sometimes something else also helps.

@sodic
Copy link
Contributor

sodic commented Jul 3, 2024

Ideas:

  • The file most likely really is missing (i.e., it's not an error in the code trying to find the file) because:
    1. TSC crashes immediately after not being able to find the file.
    2. One user added it to devDependencies at the root of the project, which fixed the problem immediately.
  • Our best guess is that, sometimes, the @tscofig/node18 doesn't get installed to top-level node_modules.

Other thoughts:

  • The SDK lists tsconfig/node18 as a devDependency. How come it's ever installed (devDependencies shouldn't be installed for packages)? Is it because it's a linked package?
  • The server also lists tsconfig/node18 as a devDependency. I forgot how NPM install works if the package is already installed in scope (I think it just duplicates it)?
  • The central question: Why do we ever get tsconfig/node18 installed in top-level node_modules. Do we just get lucky that some other package includes it as a regular dependency? Does NPM install devDependencies for SDK? Does this also happen in production?
  • Implement npm workspaces  #1653 might fix this problem.

One problem I noticed:

  • It seems we treat the SDK as a dependency (i.e., we don't run npm install inside its folder, it's installed indirectly through the root package.json), but we also treat it as a project (i.e., we build it). This is wrong and might be related to this problem. In other words, tsconfig/node18 is possibly being installed by luck.

@sodic
Copy link
Contributor

sodic commented Jul 4, 2024

For users running into this: Please zip the entire project that exhibits this behavior and send it to us :)

@Moamethic
Copy link

Hi
I tried everything discussed here and nothing worked for me, so here is the download link to my project zip:
https://mega.nz/file/YH1AgBLa#URDfK1Pyv0zpD8JcoZz-OqxJIx_o-YrMTjSjH3w7PO8

P.S: Sorry for the large file size, I just included everything for better diagnosis.

@infomiho
Copy link
Contributor

@Moamethic Hey, thank you for the info. Could you share the error message you see?

@Moamethic
Copy link

Moamethic commented Jul 16, 2024

@Moamethic Hey, thank you for the info. Could you share the error message you see?

Sure.

🐝 --- Building SDK... ------------------------------------------------------------


[  Wasp  ] tsconfig.json(2,14): error TS6053: File '@tsconfig/node18/tsconfig.json' not found.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(1,23): error TS2688: Cannot find type definition file for 'jest'.
[  Wasp  ] ../../../../node_modules/@testing-library/jest-dom/types/jest.d.ts(9,27): error TS2304: Cannot find name 'expect'.
[  Wasp  ] ../../../../node_modules/vitest/node_modules/vite/dist/node/index.d.ts(5,41): error TS2307: Cannot find module 'rollup/parseAst' or its corresponding type declarations.
[  Wasp  ]   There are types at '/root/my-proj/app/node_modules/vitest/node_modules/rollup/dist/parseAst.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.

❌ --- [Error] Your wasp project failed to compile: -------------------------------

- SDK build failed with exit code: 2


❌ --- [Error] Compilation of wasp project failed: --------------------------------

1 errors found

@infomiho
Copy link
Contributor

And also, which Node version and Wasp version are you using? Thank you for reporting this 👍

Until we find out the root cause, did you maybe try using Node 20 + running wasp clean and wasp start again?

@Moamethic
Copy link

And also, which Node version and Wasp version are you using? Thank you for reporting this 👍

Until we find out the root cause, did you maybe try using Node 20 + running wasp clean and wasp start again?

At first I was using node 18, then I installed nvm and tried with node 20 using wasp clean, but the issue still persists. I installed wasp using curl -sSL https://get.wasp-lang.dev/installer.sh | sh two hours ago, so I'm using the current latest version for sure. And I run it on Ubuntu 24.04.

@Martinsos
Copy link
Member

@Martinsos
Copy link
Member

@sodic
Copy link
Contributor

sodic commented Jul 26, 2024

@Moamethic Hey, I'm looking at your code now.

Can you maybe share the NPM version you used when you hit the bug (if you remember)?

@Moamethic
Copy link

@Moamethic Hey, I'm looking at your code now.

Can you maybe share the NPM version you used when you hit the bug (if you remember)?

Unfortunately I don't remember.

@santolucito
Copy link
Contributor

What also worked was switching to node 20, then that dev dependency was not needed, same like other users.

I also ran into the issue on Node 18, and switching to Node 20 fixed it

@sodic
Copy link
Contributor

sodic commented Aug 8, 2024

@santolucito Please tell me you remember your NPM version when it was broken 🙏

@santolucito
Copy link
Contributor

santolucito commented Aug 8, 2024

I have no idea. I had spun up a Digital Ocean server and went through the install steps normally. I can redo this quickly if you want and check things. Just let me know what you want to know.

@sodic
Copy link
Contributor

sodic commented Aug 8, 2024

@santolucito If you could reproduce the bug in a Digital Ocean setup, tell me the versions of:

  • node
  • npm
  • wasp

And zip your project code - I'd be eternally grateful! I just hope you'll be able to reproduce it. This bug's pretty hard to catch.

@santolucito
Copy link
Contributor

@sodic I sent you an email to the email listed on your profile.

@sodic
Copy link
Contributor

sodic commented Aug 8, 2024

Thanks @santolucito, you're a life-saver!

The bug happens only with NPM versions older v9.5.0. I can reproduce it with any version of Node (18.x.x or 20.x.x), as long as I use an old enough installation of npm.

To fix the problem, update your NPM version to v9.5.0 or higher. I recommend updating it to the latest version.

In a regular setup:

npm install -g npm@latest

If you're using nvm:

nvm install-latest-npm

After that, run wasp clean, and you're good to go!

Since the bug only happens with NPM versions older than 2.5 years, and we know how to fix it, I'm closing the issue.
This problem does indicate something is off in our installation configuration, but that's already tracked here: #2150.
We should also warn users when they're using an NPM version that Wasp doesn't work with, tracked here: #2113.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants