This tutorial will guide you through the process of installing Node.js and npm (Node Package Manager) on Windows and Ubuntu. After installation, we'll write a simple example to verify the setup is working correctly by outputting hello! it works!
.
Win + R
, type cmd, and press Enter
.node -v
npm -v
Ctrl + Alt + T
.sudo apt update
You can install Node.js from the NodeSource repository for the most up-to-date release.
sudo apt install curl software-properties-common
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs
node -v
npm -v
Now that Node.js is installed, let's create a simple program to verify the setup.
hello.js
using your preferred text editor or command line.console.log("hello! it works!");
node hello.js
hello! it works!
You now have Node.js installed on both Windows and Ubuntu, and you've run a simple program to output text. This environment sets the foundation for developing applications using JavaScript and various Node.js packages.
If you encounter any issues during installation, check Node's official documentation or seek help from community forums.
Happy coding!