Home > Web Front-end > JS Tutorial > body text

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

王林
Release: 2024-08-26 21:35:06
Original
301 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 GitBash link

4. Open the GitBash that you downloaded

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

How To Use Node JS By Displaying (

6. Create a directory for your project by typing mkdir your-project-name

How To Use Node JS By Displaying (

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

How To Use Node JS By Displaying (

8. Create a file main.js (file name as needed) using echo accompanied by console.log before the file name

How To Use Node JS By Displaying (

9. Run the file you have created by typing node main.js

How To Use Node JS By Displaying (

10. See the Results

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

11. If editing is required, you can type nodepad 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 = runs 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 = creates 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

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template