How To Use Node JS By Displaying (\'Hello World\')

王林
Release: 2024-08-26 21:35:06
Original
204 people have browsed it

1.Open a Web Browser Like Chrome, Edge or another

2.Download Node.js on the Web Browser you use or click the following link NodeJS (currently recommended version v20.16.0 (LTS))

How To Use Node JS By Displaying (

3.Download GitBash for the terminal on the website you use or click the following link GitBash

4.Open the GitBash that you downloaded

5.Check your node version (current recommended version v20.16.0 (LTS)) by typingnode -v

How To Use Node JS By Displaying (

6.Create a directory for your project by typingmkdir your-project-name

How To Use Node JS By Displaying (

7.Enter the directory you created by typingcd your-project-name

How To Use Node JS By Displaying (

8.Create a filemain.js(file name as needed) usingechoaccompanied by console.log before the file name

How To Use Node JS By Displaying (

9.Run the file you have created by typingnode main.js

How To Use Node JS By Displaying (

10.See Results

The results will come out like this
How To Use Node JS By Displaying (

11.If editing is required, you can typenodepad main.js

How To Use Node JS By Displaying (

Note:

node -v = view node.js version. minimum version 20
npm -v = to see the npm (package managing) version. minimum version 10
node = running js file

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 the 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 file editing

The above is the detailed content of How To Use Node JS By Displaying (\'Hello World\'). For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!