1.dowload node js here
2.
Click Download
3.and download when it is open in the file manager
make sure your node version is at least v-20 and make sure the system type is the same as your laptop/PC, for example here the system type is x64
4.and make sure you download git bash
note
-Do not use any tools. just use the default
-terminal using Git - Downloads (git-scm.com)
5.and To make sure Node.js is installed, open Command Prompt (CMD) and type:
and the version you downloaded will come out and that will ensure that your node js has been downloaded
6.create a directory
project Open a Command Prompt or terminal and create a directory for your project, then go into it:
7. create a file for example main.js
8.run js file
9.the results bring up
10.edit if necessary using
note
terminal
ls = to view the contents of the folder
ls -a = to see all folder contents including hidden ones
DIR = to view the contents of the folder in Windows
mkdir = create folder
cd = to go to folder
cd .. = to exit folder
touch = to create file (os)
echo 'console.log("hello students")' > main.js (create file)
rm = to delete files (MAC)
del = to delete files (Windows)
Nano / Edit file contents (Only on MAC OS and Linux)
nano = edit file
ctrl + o = save file (enter)
ctrl + x = exit edit file
Node
node -v = view node.js version. minimum version 20
npm -v = to see the npm (package managing) version. minimum version 10
The above is the detailed content of Tutorial on using node js to display hello world. For more information, please follow other related articles on the PHP Chinese website!