Compiling/Running TypeScript projects with Glitch

Hello, I am currently trying to build a password manager backend with TypeScript. The code compiles and executes seamlessly on my computer. However, upon attempting to compile or execute it via Glitch, I encounter errors.

Source code on Github | Glitch project

When I try to build via npm run build, the following error occurs:

$ npm run build

> server@0.9.1 build /app
> tsc -p .

/rbd/pnpm-volume/a5eae7a5-6302-4098-ac34-e979689b5364/node_modules/.registry.npmjs.org/typescript/5.6.2/node_modules/typescript/lib/tsc.js:92
  for (let i = startIndex ?? 0; i < array.length; i++) {
                           ^

SyntaxError: Unexpected token ?

When I try to run with the ts-node tool, npm run start-ts, the following error occurs:

$ npm run start-ts

> server@0.9.1 start-ts /app
> ts-node src/index.ts

sh: 1: ts-node: not found

I have installed all dependencies and updated the package.json file to set the Node version requirement to >=20.0.0. Thanks in advance!

Node 20 is not currently supported, have a look at https://help.glitch.com/hc/en-us/articles/16287495688845-What-version-of-Node-can-I-use-and-how-do-I-change-update-upgrade-it to see what the options are.

2 Likes