can't find definition file for node or jest
I have tried so many things. Does someone have a solution?
[{ "resource": "/c:/Users/boost/AIagent/agent/tsconfig.json", "owner": "typescript", "severity": 8, "message": "Cannot find type definition file for 'jest'.\n The file is in the program because:\n Entry point of type library 'jest' specified in compilerOptions", "source": "ts", "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 2 }]
[{ "resource": "/c:/Users/boost/AIagent/agent/tsconfig.json", "owner": "typescript", "severity": 8, "message": "Cannot find type definition file for 'node'.\n The file is in the program because:\n Entry point of type library 'node' specified in compilerOptions", "source": "ts", "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 2 }]
Which version of Eliza are you using v0 or v1?
I am using the latest version. v0.25.19 Release
I am using windows- VScode- WSL ubuntu
I have all the Prerequisites
I notice it wants to use nvm 23.3.0. It is installed and I use it.
It wants to use pnpm 9.15.7. It is installed and used.
I forked it to do custom characters and to eventually run Mutiple agents on railway.
Pnpm i
Pnpm build is a success
As soon as I open the defaultcharcater.ts
The tsconfig.json turns red and alerts me that type definitions for node or jest.
My steps to resolve
cd agent (agent folder)
npm install --save-dev @types/node @types/jest
Got errors, then tried
npm install -g pnpm
pnpm install --filter agent --save-dev @types/node @types/jest
I got
ok we may getting somewhere lol. now it's saying this --[{
"resource": "/c:/Users/boost/AIagent/agent/tsconfig.json",
"owner": "typescript",
"severity": 8,
"message": "Cannot find type definition file for 'jest'.\n The file is in the program because:\n Entry point of type library 'jest' specified in compilerOptions",
"source": "ts",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}] and this [{
"resource": "/c:/Users/boost/AIagent/agent/tsconfig.json",
"owner": "typescript",
"severity": 8,
"message": "Cannot find type definition file for 'node'.\n The file is in the program because:\n Entry point of type library 'node' specified in compilerOptions",
"source": "ts",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}]
I ran
pnpm install --filter agent --save-dev @types/node @types/jest
Did not fix.
Then I checked
If @types/node and @types/jest are listed is in package.json under devDependencies.
Added this because it was saying @elizaos/core wasn't being found, but it would not fix the "Cannot find type definition file for 'jest'" and "node" errors. Those errors are about missing type definitions.
// ...existing code...
"compilerOptions": {
// ...existing code...
"types": ["node", "jest"],
"paths": {
"@elizaos/core": ["../packages/core/src"]
}
},
// ...existing code...
In devDependencies I see this now
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "29.5.14",
"@types/node": "^22.15.23",
"jest": "29.7.0",
"ts-jest": "^29.2.6"
}
Ran pnpm install from my workspace root
Reloaded VS Code
ran
pnpm exec tsc --build --clean && pnpm exec tsc –noEmit
when I tried pnpm exec tsc --build --clean, I got this error TS5083: Cannot read file
-slack/tsconfig.json'. ODB7VVB:/mnt/c/Users/boost/AIagent$ pnpm exec tsc --build --clean && pnpm exec tsc --noEmit
error TS5083: Cannot read file '/mnt/c/Users/boost/AIagent/packages/client-slack/tsconfig.json'.
tsconfig.json:18:9 - error TS6053: File '/mnt/c/Users/boost/AIagent/packages/client-slack' not found.
18 {
~
19 "path": "packages/client-slack"
20 }
~~~~~~~~~
Found 1 error in tsconfig.json:18
Used copilot to help
It said this -
The error occurs because your root tsconfig.json references a package (packages/client-slack) that does not exist in your workspace. TypeScript is trying to build all referenced projects, but it can't find that folder.
To fix this:
Remove or comment out the reference to packages/client-slack in your root tsconfig.json.
Save the file.
Re-run the clean and type-check commands.
I'll update your root tsconfig.json to remove the missing reference for you.
Made changes.
pnpm exec tsc --build --clean && pnpm exec tsc –noEmit
Then suggested this
Here are some final troubleshooting steps to clear the phantom errors:
1. Restart VS Code completely (close all windows, then reopen). 2. Delete the node_modules and lockfile in agent (sometimes stale modules cause issues):
rm -rf node_modules pnpm-lock.yaml
pnpm install
(Run these from your workspace root.) 3. Check for duplicate tsconfig.json files in parent folders that might confuse VS Code. You should have one in the root and one in each package, but not extra ones. 4. Make sure your tsconfig.json has the correct types and paths (which it does, based on your previous messages). 5. Try running this in the agent folder to see if TypeScript itself sees errors:
pnpm exec tsc --noEmit
Let me know the result of running pnpm exec tsc --noEmit in the agent folder!
It then found 38 errors in 13 files.
Now I have deleted it all. Will re-clone once I can hopefully find a solution. Could it be my VsCode is somehow now doing the typescript environment right? maybe just buggy? idk.