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.
- nodejs.org
- npmjs.com
- 安装方式:压缩包、nvm,其中包含npm
- 查看版本
node -v
History
版本 发布时间 维护截至
- 18.x 2022/04/19 2025/04/30
- 16.x 2021/4/20 2024/4/30
- 14.x 2020/4/21 2023/4/30
- 12.x 2019/4/23 2022/4/30
- 10.x 2018/4/24 2021/4/30
参考
使用NPM
- 查看版本
npm -v
- 查看配置
npm config list
- 修改镜像
npm install -g mirror-config-china --registry=http://registry.npm.taobao.org
- Cache files are stored in
~/.npm
on Posix, or%AppData%/npm-cache
on Windows.
演示:创建Web服务
1 | // 创建服务 |
使用PM2管理
- 安装
npm install pm2 -g
- 启动
pm2 start | stop | restart | delete
- 监控
pm2 monit
- 进程列表
pm2 list
- 使用PM2启动Express.js:
pm2 start bin/www