W
Wasp2d ago
wardbox

Wasp typescript error

version = 0.16.2 logs
dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp clean

:bee: --- Deleting the .wasp/ directory... -------------------------------------------


:white_check_mark: --- Nothing to delete: The .wasp/ directory does not exist. --------------------


:bee: --- Deleting the node_modules/ directory... ------------------------------------


:white_check_mark: --- Deleted the node_modules/ directory. ---------------------------------------


dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3 took 5.4s
 node -v
v20.18.3

dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp ts-setup

[ Wasp ] added 629 packages, and audited 632 packages in 6s
[ Wasp ]
[ Wasp ] 154 packages are looking for funding
[ Wasp ] run `npm fund` for details
[ Wasp ]
[ Wasp ] 2 moderate severity vulnerabilities
[ Wasp ]
[ Wasp ] To address all issues (including breaking changes), run:
[ Wasp ] npm audit fix --force
[ Wasp ]
[ Wasp ] Run `npm audit` for details.%

dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3 took 5.9s
 wasp start db

[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

:x: --- [Error] Analyzing wasp project failed: -------------------------------------

1 errors found:
- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.
dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp clean

:bee: --- Deleting the .wasp/ directory... -------------------------------------------


:white_check_mark: --- Nothing to delete: The .wasp/ directory does not exist. --------------------


:bee: --- Deleting the node_modules/ directory... ------------------------------------


:white_check_mark: --- Deleted the node_modules/ directory. ---------------------------------------


dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3 took 5.4s
 node -v
v20.18.3

dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp ts-setup

[ Wasp ] added 629 packages, and audited 632 packages in 6s
[ Wasp ]
[ Wasp ] 154 packages are looking for funding
[ Wasp ] run `npm fund` for details
[ Wasp ]
[ Wasp ] 2 moderate severity vulnerabilities
[ Wasp ]
[ Wasp ] To address all issues (including breaking changes), run:
[ Wasp ] npm audit fix --force
[ Wasp ]
[ Wasp ] Run `npm audit` for details.%

dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3 took 5.9s
 wasp start db

[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

:x: --- [Error] Analyzing wasp project failed: -------------------------------------

1 errors found:
- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.
22 Replies
kapa.ai
kapa.ai2d ago
Hi @wardbox. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the error logs you've provided, it seems you're encountering a TypeScript-related issue with your Wasp project. Let's break down the problem and provide a solution: 1. First, it's important to note that you're using Wasp version 0.16.2, which is a recent version that supports TypeScript. 2. The error message suggests that the TypeScript compiler (tsc) is not available in your project. To resolve this issue, you need to install TypeScript in your project. Here are the steps you can follow: 1. Install TypeScript as a dev dependency in your project:
npm install --save-dev typescript
npm install --save-dev typescript
2. After installing TypeScript, try running the wasp start db command again. If you're still encountering issues, you might want to try the following: 1. Make sure you're using a compatible Node.js version. Wasp typically requires Node.js 18.x LTS. You're currently using Node.js v20.18.3, which might cause compatibility issues. Consider switching to Node.js 18.x using a version manager like nvm. 2. Run wasp clean again to ensure all generated files are removed. 3. Run wasp start to regenerate all necessary files and start your project. If the problem persists, it might be related to how TypeScript is set up in your Wasp project. You can check the Wasp TypeScript documentation for more details on how to properly set up and use TypeScript with Wasp. Remember, if you continue to face issues, you can always reach out to the Wasp community on their Discord channel for more specific help. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wardbox, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wardbox
wardboxOP2d ago
@kapa.ai
dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp clean

🐝 --- Deleting the .wasp/ directory... -------------------------------------------


✅ --- Nothing to delete: The .wasp/ directory does not exist. --------------------


🐝 --- Deleting the node_modules/ directory... ------------------------------------


✅ --- Deleted the node_modules/ directory. ---------------------------------------


dylank in sunderer on  wardbox/v1 [✘!] via ⬢ v20.18.3 took 5.6s
 wasp start

🐝 --- Starting compilation and setup phase. Hold tight... ------------------------


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


[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

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

- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.


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

1 errors found
dylank in sunderer on  wardbox/v1 [!] via ⬢ v20.18.3
 wasp clean

🐝 --- Deleting the .wasp/ directory... -------------------------------------------


✅ --- Nothing to delete: The .wasp/ directory does not exist. --------------------


🐝 --- Deleting the node_modules/ directory... ------------------------------------


✅ --- Deleted the node_modules/ directory. ---------------------------------------


dylank in sunderer on  wardbox/v1 [✘!] via ⬢ v20.18.3 took 5.6s
 wasp start

🐝 --- Starting compilation and setup phase. Hold tight... ------------------------


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


[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

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

- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.


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

1 errors found
kapa.ai
kapa.ai2d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the error logs you've provided, it seems you're still encountering a TypeScript-related issue with your Wasp project. The error message indicates that the TypeScript compiler (tsc) is not available in your project. Let's address this issue: 1. First, you need to install TypeScript in your project. Run the following command in your project directory:
npm install --save-dev typescript
npm install --save-dev typescript
2. After installing TypeScript, try running wasp start again. If you're still facing issues after installing TypeScript, there might be a compatibility problem with the Node.js version you're using. According to the Wasp Quick Start documentation, Wasp requires Node.js version 18 or higher. You're currently using Node.js v20.18.3, which should be compatible, but it's worth noting that Wasp has only recently updated its Node.js requirements. If the problem persists after installing TypeScript, you might want to try the following: 1. Double-check that your main.wasp file is correctly named and formatted. The error message mentions main.wasp.ts, which is not the standard naming convention for Wasp files. Ensure your main Wasp file is named main.wasp (without the .ts extension). 2. If you've made any recent changes to your Wasp configuration or TypeScript setup, review those changes to ensure they're correct. 3. You can also try running wasp compile to see if it provides more detailed error messages about any TypeScript-related issues in your Wasp files. If you continue to face issues, you might want to reach out to the Wasp community on their Discord channel for more specific help, as they might have encountered similar issues with recent versions of Wasp and Node.js. Remember, Wasp is actively developed, and its compatibility with different Node.js versions and TypeScript setups may change. Always refer to the most recent documentation for the most up-to-date information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wardbox, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wardbox
wardboxOP2d ago
@kapa.ai i did run that command to install typescript i also tried going to an older version of node
 nvm use 18.18.0
Now using node v18.18.0 (npm v9.8.1)

dylank in sunderer on  wardbox/v1 [✘!] via ⬢ v18.18.0 took 2.4s
 wasp ts-setup

[ Wasp ] added 629 packages, and audited 632 packages in 26s
[ Wasp ]
[ Wasp ] 154 packages are looking for funding
[ Wasp ] run `npm fund` for details
[ Wasp ]
[ Wasp ] 2 moderate severity vulnerabilities
[ Wasp ]
[ Wasp ] To address all issues (including breaking changes), run:
[ Wasp ] npm audit fix --force
[ Wasp ]
[ Wasp ] Run `npm audit` for details.%

dylank in sunderer on  wardbox/v1 [!] via ⬢ v18.18.0 took 26.4s
 wasp start db

[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

❌ --- [Error] Analyzing wasp project failed: -------------------------------------

1 errors found:
- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.
 nvm use 18.18.0
Now using node v18.18.0 (npm v9.8.1)

dylank in sunderer on  wardbox/v1 [✘!] via ⬢ v18.18.0 took 2.4s
 wasp ts-setup

[ Wasp ] added 629 packages, and audited 632 packages in 26s
[ Wasp ]
[ Wasp ] 154 packages are looking for funding
[ Wasp ] run `npm fund` for details
[ Wasp ]
[ Wasp ] 2 moderate severity vulnerabilities
[ Wasp ]
[ Wasp ] To address all issues (including breaking changes), run:
[ Wasp ] npm audit fix --force
[ Wasp ]
[ Wasp ] Run `npm audit` for details.%

dylank in sunderer on  wardbox/v1 [!] via ⬢ v18.18.0 took 26.4s
 wasp start db

[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

❌ --- [Error] Analyzing wasp project failed: -------------------------------------

1 errors found:
- Got TypeScript compiler errors for /Users/dylank/personal_git/sunderer/main.wasp.ts.
kapa.ai
kapa.ai2d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Based on the error logs you've provided, it seems that the TypeScript issue is persisting despite switching to Node.js v18.18.0 and running wasp ts-setup. Let's try to address this issue step by step: 1. First, it's important to note that your main Wasp file seems to be named main.wasp.ts. This is not the correct naming convention for Wasp files. Wasp files should be named main.wasp without the .ts extension. 2. Rename your main.wasp.ts file to main.wasp. 3. After renaming the file, try running wasp clean to remove any generated files:
wasp clean

wasp clean

4. Then, run wasp start db again:
wasp start db

wasp start db

If you're still encountering issues, let's try to manually install TypeScript in your project: 1. Navigate to your project directory in the terminal. 2. Run the following command to install TypeScript as a dev dependency:
npm install --save-dev typescript

npm install --save-dev typescript

3. After installing TypeScript, try running wasp start db again. If the problem persists, it might be related to how TypeScript is set up in your Wasp project. You can check the Wasp TypeScript documentation for more details on how to properly set up and use TypeScript with Wasp. If none of these steps resolve the issue, you might want to consider creating a new Wasp project from scratch to see if the problem occurs in a fresh project. This can help isolate whether the issue is specific to your current project setup or if it's a more general problem with your Wasp installation. Remember, if you continue to face issues, the Wasp community on their Discord channel can provide more specific help, as they might have encountered similar issues with recent versions of Wasp and TypeScript setups. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @wardbox, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
wardbox
wardboxOP2d ago
could not figure this out, tried doing the npm install after clean with no luck
genyus
genyus2d ago
I flagged this as an issue with the TS config: https://discord.com/channels/686873244791210014/1341575371572772864/1341773607793201172 Try wasp clean && npm install && wasp start
wardbox
wardboxOP2d ago
yea tried that, same error
genyus
genyus2d ago
Ooh. Can you share your main.wasp.ts?
wardbox
wardboxOP2d ago
ehhh im already going back to the normal main.wasp to try to get that working, running into the same issue though which is odd, thinking it might be package related
genyus
genyus2d ago
It's complaining about TS compiler errors for main.wasp?
wardbox
wardboxOP2d ago
this one
✅ --- Database successfully set up. ----------------------------------------------


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


[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

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

- SDK build failed with exit code: 1


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

1 errors found
✅ --- Database successfully set up. ----------------------------------------------


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


[ Wasp ]
[ Wasp ]
[ Wasp ] This is not the tsc command you are looking for
[ Wasp ]
[ Wasp ]
[ Wasp ] To get access to the TypeScript compiler, tsc, from the command line either:
[ Wasp ]
[ Wasp ] - Use npm install typescript to first add TypeScript to your project before using npx
[ Wasp ] - Use yarn to avoid accidentally running code from un-installed packages

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

- SDK build failed with exit code: 1


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

1 errors found
this is running wasp db migrate-dev after wasp clean
genyus
genyus2d ago
So for me, I found that npm install was required before any other operation after running wasp clean, but if you've rolled back to main.wasp, that shouldn't still be an issue
wardbox
wardboxOP2d ago
yeah it's weird lol
genyus
genyus2d ago
Might be a silly question, but you undid the changes to your tsconfig.json file as well?
wardbox
wardboxOP2d ago
yeah i reverted to this
// =============================== IMPORTANT =================================
//
// This file is only used for Wasp IDE support. You can change it to configure
// your IDE checks, but none of these options will affect the TypeScript
// compiler. Proper TS compiler configuration in Wasp is coming soon :)
{
"include": ["src"],
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"outDir": ".wasp/out/user",
"module": "esnext",
"target": "esnext",

// We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly.
"moduleResolution": "bundler",
// JSX support
"jsx": "preserve",
"strict": true,
// Allow default imports.
"esModuleInterop": true,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"typeRoots": [
// This is needed to properly support Vitest testing with jest-dom matchers.
// Types for jest-dom are not recognized automatically and Typescript complains
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
"node_modules/@testing-library",
// Specifying type roots overrides the default behavior of looking at the
// node_modules/@types folder so we had to list it explicitly.
// Source 1: https://www.typescriptlang.org/tsconfig#typeRoots
// Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
"node_modules/@types"
],
},
}
// =============================== IMPORTANT =================================
//
// This file is only used for Wasp IDE support. You can change it to configure
// your IDE checks, but none of these options will affect the TypeScript
// compiler. Proper TS compiler configuration in Wasp is coming soon :)
{
"include": ["src"],
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"outDir": ".wasp/out/user",
"module": "esnext",
"target": "esnext",

// We're bundling all code in the end so this is the most appropriate option,
// it's also important for autocomplete to work properly.
"moduleResolution": "bundler",
// JSX support
"jsx": "preserve",
"strict": true,
// Allow default imports.
"esModuleInterop": true,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"typeRoots": [
// This is needed to properly support Vitest testing with jest-dom matchers.
// Types for jest-dom are not recognized automatically and Typescript complains
// about missing types e.g. when using `toBeInTheDocument` and other matchers.
"node_modules/@testing-library",
// Specifying type roots overrides the default behavior of looking at the
// node_modules/@types folder so we had to list it explicitly.
// Source 1: https://www.typescriptlang.org/tsconfig#typeRoots
// Source 2: https://github.com/testing-library/jest-dom/issues/546#issuecomment-1889884843
"node_modules/@types"
],
},
}
genyus
genyus2d ago
Isn't that "include" entry one of the changes you made for the TS config?
wardbox
wardboxOP2d ago
that's for 0.15 to 0.16 afaik i just reverted my package.json to the very first version and it's fine now :fine: i think it was this "wasp-config": "file:../../.local/share/wasp-lang/0.16.2/data/packages/wasp-config" when that was in there it didn't work, when i removed it it seemed to work
genyus
genyus2d ago
Ah. That would be the result of the wasp ts-setup command, which would also need to be removed if you're reverting back to the conventional setup. Well, glad you have everything working again
wardbox
wardboxOP2d ago
it also involved removing "tsc": "^2.0.4", from package.json
genyus
genyus2d ago
Oh, that was kapa trying to be helpful, but actually making things worse 😅
miho
miho2d ago
@sodic one for you

Did you find this page helpful?