首页服务器Linux服务器 Linux环境下nodejs的安装图文教程

Linux环境下nodejs的安装图文教程

1、在官网下载nodejs,选择左边的。 2、选择文件右击点击extract here进行解压 3、进入bin目录,右击选择properties,解压文件可以随意放在系统里一个位置。复制location里的…

1、在官网下载nodejs,选择左边的。

linux,安装,nodejs

2、选择文件右击点击extract here进行解压

linux,安装,nodejs

3、进入bin目录,右击选择properties,解压文件可以随意放在系统里一个位置。复制location里的路径

linux,安装,nodejslinux,安装,nodejs

4、添加路径 进入.bashrc文件,在末尾处添加步骤三的location里的路径。

linux,安装,nodejs

linux,安装,nodejs

6、在终端输入source .bashrc按回车键,再输出路径:echo $PATH检查路径是否已经添加成功

linux,安装,nodejs

7、检测是否安装nodejs成功。在js文件目录下点击右键,再点击open in terminal,进入终端,输入node 文件名(我安装时文件名为qishuixian.js) 

consloe.log("1111")

linux,安装,nodejs linux,安装,nodejs

8、在浏览器测试:server.js源码:

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/'); 
本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/fwq/Linux/8849.html
上一篇Linux系统下安装rz/sz命令及使用说明(详解)
下一篇 详解Linux Socket编程(不限Linux)
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部