认识
Node.js is a JavaScript-based platform for server-side and networking applications. Node.js 是一个开源的、跨平台的 JavaScript 运行时环境,它允许开发者使用 JavaScript 来编写服务器端代码。
组成
WIP
构建
镜像仓库:https://hub.docker.com/_/node
Node.js v10.x on CentOS 7
Enterprise Linux based distributions
# Step 1 – Add Node.js Yum Repository curl -sL https://rpm.nodesource.com/setup_10.x | bash - # Step 2 – Install Node.js on CentOS yum install nodejs-10.15.3 # 安装指定版本 yum install nodejs ################################################################################ # Step 3 – Check Node.js and NPM Version ################################################################################ node -v npm -v
Node.js 15.x on Debian GNU/Linux 10 (buster)
# Using Debian, as root curl -sL https://deb.nodesource.com/setup_15.x | bash - apt-get install -y nodejs
Node.js v12.x on Debian
适用发行版:Debian,Ubuntu 18.04.3 LTS
# 08/13/2019
# Using Debian, as root curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs
性质
- 异步非阻塞 I/O:Node.js 使用事件驱动、非阻塞 I/O 模型,使其轻量且高效。
- 单线程事件循环:采用单线程事件循环架构,适合 I/O 密集型应用。
- 基于 Chrome V8 引擎:使用 Google 的 V8 JavaScript 引擎,执行速度快。
- npm 生态系统:拥有全球最大的开源库生态系统(npm)。
- 使用 JavaScript 统一前后端开发
- 高性能(特别是 I/O 密集型任务)
- 活跃的社区和丰富的模块
- 适合快速开发原型
应用
构建 Web 服务器和 API 服务
实时应用程序(如聊天应用)
微服务架构
命令行工具
后端服务(BFF – Backend For Frontend)
Node.js 特别适合需要处理大量并发连接但每个请求不需要太多 CPU 计算的应用程序。
参考
How To Install Latest Nodejs on CentOS/RHEL 7/6
NodeSource Node.js Binary Distributions
distributions/README.md at master · nodesource/distributions
NodeSource Node.js Binary Distributions
DeepSeek / 介绍 node.js