How do I run node js in Ubuntu? js and NPM(Node Package Manager) using “sudo apt install nodejs” and “sudo apt install npm” commands respectively. After installation, create a file with the “. js” extension, write Node. js code in it, and execute the file using the “node filename” command.