Trying to get up and running with an Express app, but running into an error when `npm run start`
Attached the errors as a txt file.
15 Replies
try to set
declarations
to false and strict
to true in your tsconfigNo luck there. Here's my tsconfig
can you try to exclude node_modules
Excuse me, but how exactly do I do that? Sort of new to Express and TS
Thanks for your patience. Unfortunately, still no luck
For a bit more context, I followed the instructions for setting up better auth from here
https://www.better-auth.com/docs/installation
And the instructions for node+express+ts from here:
https://www.digitalocean.com/community/tutorials/setting-up-a-node-project-with-typescript
Installation | Better Auth
Learn how to configure Better Auth in your project.
How To Set Up a Node Project With Typescript | DigitalOcean
Writing server-side JavaScript can be challenging as a codebase grows. TypeScript is a typed (optional) super-set of JavaScript that can help with building a…
"Note that CommonJS (cjs) isn't supported. Use ECMAScript Modules (ESM) by setting "type": "module" in your package.json or configuring your tsconfig.json to use ES modules."
You cant use commonjs.
Express Integration | Better Auth
Integrate Better Auth with Express.
@j_slno hello, I changed to modules, and I'm still getting the same errors
tsconfig:
And in package.json I have
"type": "module",
Have you tried to delete
node_modules
and your lock file and reinstall again?
lib
should be inside compilerOptions
also make sure to set declarations
to false@j_slno Thanks for your help. I just created the entire project from scratch, and did some more research, and I finally got the server to run it seems. I do, however have a new issue which is this

Try assign types from express
import {Request, Response} from 'express';
then use (req:Request,res:Response)
Just solved the issue. Was using express 4 but express types 5, and apparently they are not compatible
Well glad you fixed it