Home > php教程 > PHP开发 > Graphical tutorial for installing nodejs in Linux environment

Graphical tutorial for installing nodejs in Linux environment

高洛峰
Release: 2017-01-04 16:33:44
Original
1246 people have browsed it

1. Download nodejs from the official website and select the one on the left.

Graphical tutorial for installing nodejs in Linux environment

2. Select the file, right-click and click extract here to decompress

Graphical tutorial for installing nodejs in Linux environment

3. Enter the bin directory, right-click and select properties, the decompressed file can be placed anywhere in the system. Copy the path in the location

Graphical tutorial for installing nodejs in Linux environment

Graphical tutorial for installing nodejs in Linux environment

4. Add the path. Enter the .bashrc file and add the path in the location in step three at the end.

Graphical tutorial for installing nodejs in Linux environment

Graphical tutorial for installing nodejs in Linux environment

6. Enter source .bashrc in the terminal, press Enter, and then output the path: echo $PATH to check whether the path has been added successfully.

Graphical tutorial for installing nodejs in Linux environment

#7. Check whether nodejs is successfully installed. Right-click in the js file directory, then click open in terminal, enter the terminal, enter the node file name (the file name was qishuixian.js when I installed it)

consloe.log("1111")

Graphical tutorial for installing nodejs in Linux environment

8. Test in the browser: server.js source code:

var http = require('http'); 
http.createServer(function (request, response) {  
response.writeHead(200, 
 {'Content-Type':'text/html;charset=utf-8'});  
 if(request.url!=="/favicon.ico"){   
console.log('访问');   
 response.write('hello,world');   
response.end('你好,世界'); 
 } 
}).listen(8000); console.log('Server running at http://127.0.0.1:8000/');
Copy after login

Graphical tutorial for installing nodejs in Linux environment

Graphical tutorial for installing nodejs in Linux environment

All of the above This is the graphic tutorial for installing nodejs in the Linux environment introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!


For more graphic tutorials on nodejs installation in Linux environment, please pay attention to the PHP Chinese website!


Related labels:
source:php.cn
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template