如何在FreeBSD 12上安装Node.js 10 LTS和NPM
这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。
将指南下载为PDF
关
这是续集。
这是续集。
这是续集。
欢迎来到我们的指南,了解如何在FreeBSD 12上安装Node.js 10 LTS。 Node.js是一种流行的免费开源服务器端编程语言,可在各种平台(Linux,Windows,Unix,MacOS)上运行。 Node10 LTS代号“b“将一直支持到2020年4月。
我之前写过另一篇有关FreeBSD 12的文章。
如何在FreeBSD 12上安装VIM文本编辑器
如何在FreeBSD 12上安装MariaDB 10.3
如何在FreeBSD 12上安装PHP 7.2
在FreeBSD 10上安装Node.js 10 LTS
Node.js是基于Chrome的V8 JavaScript引擎构建的JavaScript运行时,可轻松构建快速,可扩展的网络应用程序。要在FreeBSD 12上安装Node.js 10.x LTS,请使用: pkg
包管理器。
请参阅FreeBSD 12上可用的Node 10版本。
$ su - # pkg search node-10 node-10.11.0 V8 JavaScript for client and server
从输出中您可以看到有一个节点 10.11.0
它可以从FreeBSD仓库中获得。使用以下命令进行安装:
# pkg install node-10.11.0 Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. The following 3 package(s) will be affected (of 0 checked): New packages to be INSTALLED: node: 10.11.0 c-ares: 1.14.0_1 libuv: 1.23.1 Number of packages to be installed: 3 The process will require 32 MiB more space. 6 MiB to be downloaded. Proceed with this action? [y/N]: y
当被问到 y/n
确认,按 y。 以下是安装的示例输出
[1/3] Fetching node-10.11.0.txz: 85% 5 MiB 278.5kB/s 00:03 ETA [1/3] Fetching node-10.11.0.txz: 100% 6 MiB 125.0kB/s 00:49 [2/3] Fetching c-ares-1.14.0_1.txz: 100% 122 KiB 124.7kB/s 00:01 [3/3] Fetching libuv-1.23.1.txz: 100% 99 KiB 101.3kB/s 00:01 Checking integrity... done (0 conflicting) [1/3] Installing c-ares-1.14.0_1... [1/3] Extracting c-ares-1.14.0_1: 100% [2/3] Installing libuv-1.23.1... [2/3] Extracting libuv-1.23.1: 100% [3/3] Installing node-10.11.0... [3/3] Extracting node-10.11.0: 100% Message from node-10.11.0: Note: If you need npm (Node Package Manager), please install www/npm.
您可以使用以下命令检查Node.js的安装版本。
# node --version v10.11.0
有关诸如依赖性之类的软件包的更多信息, pkg info
输出。
# pkg info node-10.11.0 node-10.11.0 Name : node Version : 10.11.0 Installed on : Thu Dec 13 20:17:11 2018 UTC Origin : www/node Architecture : FreeBSD:12:amd64 Prefix : /usr/local Categories : www Licenses : MIT Maintainer : [email protected] WWW : https://nodejs.org/ Comment : V8 JavaScript for client and server Options : BUNDLED_SSL : on DOCS : on DTRACE : on NLS : on Shared Libs required: libicudata.so.62 libcares.so.2 libnghttp2.so.14 libicuuc.so.62 libicui18n.so.62 libuv.so.1 Annotations : FreeBSD_version: 1200086 repo_type : binary repository : FreeBSD Flat size : 30.8MiB Description : Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. WWW: https://nodejs.org/
安装节点程序包管理器
安装Node.js 10后,您可以安装NPM来帮助管理Node软件包。
# pkg install npm Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. The following 2 package(s) will be affected (of 0 checked): New packages to be INSTALLED: npm: 6.4.1 gmake: 4.2.1_2 Number of packages to be installed: 2 The process will require 18 MiB more space. 3 MiB to be downloaded. Proceed with this action? [y/N]: y [1/2] Fetching npm-6.4.1.txz: 100% 3 MiB 211.5kB/s 00:15 [2/2] Fetching gmake-4.2.1_2.txz: 100% 381 KiB 65.1kB/s 00:06 Checking integrity... done (0 conflicting) [1/2] Installing gmake-4.2.1_2... [1/2] Extracting gmake-4.2.1_2: 100% [2/2] Installing npm-6.4.1... [2/2] Extracting npm-6.4.1: 100%
安装并测试npm PM2
Node.js流程管理器
# npm install pm2 -g /usr/local/bin/pm2 -> /usr/local/lib/node_modules/pm2/bin/pm2 /usr/local/bin/pm2-dev -> /usr/local/lib/node_modules/pm2/bin/pm2-dev /usr/local/bin/pm2-docker -> /usr/local/lib/node_modules/pm2/bin/pm2-docker /usr/local/bin/pm2-runtime -> /usr/local/lib/node_modules/pm2/bin/pm2-runtime npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/pm2/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"freebsd","arch":"x64"}) + [email protected] added 313 packages from 243 contributors in 35.691s
享受在FreeBSD 12上使用Node.js 10进行开发的乐趣。
这是续集。
您可以通过以下链接以PDF格式下载本文,以为我们提供支持。
将指南下载为PDF
关
这是续集。
这是续集。
这是续集。