Using typescript compiler on glitch

I’d like to use typescript on glitch, but I’m unable to install the tsc command since node/npm aren’t available in the terminal. Is there some other way to use the typescript compiler? I’m primarily playing around with static sites, and I just want to be able to convert my .ts file into a .js file.

Firstly… both node and npm are available but I will guess you haven’t set them up. They are not present by default as a project may not need them.

I wouldn’t build TypeScript projects in the Glitch editor and if I recall correctly it isn’t actually possible. I build on my local machine and push the resulting files to Glitch.

Not a very helpful response. Open the terminal and type node or npm. They aren’t installed. How do you use node or npm in the terminal.

node and npm are available in the “full stack” and “generated static” project types. remix one of those projects, such as glitch.new/node

Thanks! Any idea how to get npm install -g typescript to not fail?

I usually go without the -g. Glitch has something set up that makes commands like tsc work even when it’s installed in the project.

3 Likes