How can I run a server-side Javascript file from the Glitch terminal?

I have a utility script that imports some data from an external source. How can I run this from the Glitch terminal?

I expected node import.js to work, but there’s no node command (“command not found”).

I know I could create a client endpoint to invoke the server code, but it would just be much easier if I could do it from the terminal.

1 Like

can you try apt-get install nodejs

Tx, I can’t believe I didn’t think of just installing it!

I can’t install using apt-get (needs root permissions), but I managed to download the Node.js binary and run it

Hey @gdog,

Node.js is available on Glitch. All you need is a package.json which will identify your project as a Node project. In your package.json, make sure you have a start script running node import.js and import.js will be run automatically every time there are changes because Glitch runs npm start automatically…

Actually, if you have a package.json file, then the node command is available.

Or it might be the presence of the “engines” section:

"engines": { "node": "12.x" },