Ubuntu教程

Ubuntu 安装Node.js

如何在 Ubuntu 16.04 LTS 上安装 Node.js?

简介

Node.js 是一个 JavaScript 框架,用于在服务器端执行 JavaScript 代码。它由 Ryan Dahl 设计和开发,于 2009 年 5 月 27 日首次发布。
它遵循事件驱动的架构,并得到 Node.js 基金会的支持。
它被广泛使用作者: 微软、IBM、GoDaddy、雅虎等科技巨头。
在本教程中,我们将在 Ubuntu 操作系统上安装 Node.js。整个过程需要一些先决条件,包括以下步骤。

先决条件

Ubuntu 使用 sudo 登录到终端 互联网连接(从 www 下载包)

Node.js 安装

使用以下命令安装 Node.js。
$ apt-get install nodejs
Software Nodejs 1
好吧,这是我们可以安装 Node.js 但它不会安装最新版本的方式。所以,我们有另一种安装方式。
使用 Curl 安装
使用此命令存储来自 Node.js 官方站点的设置。
$ curl-sL https://deb.nodesource.com/setup_6.x | sudo -E bash-
Software Nodejs 2
之后,执行以下命令。
$ apt-get install nodejs
Software Nodejs 3

验证Node.js

$ node-v
它将打印已安装的 Node.js 版本。

运行 Node.js

使用此命令运行 Node.js
$ nodejs
使用 console.log() 方法显示消息。
Software Nodejs 4
好吧,我们有在 Ubuntu 上成功安装了 Node.js。现在,我们可以制作应用程序了。

昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4