关于node.js:Nodejs-和-NPM-的安装和配置

Node.js 的装置

CentOS装置:
$ dnf module list nodejs
$ dnf module install nodejs:14
Windows 装置:

https://nodejs.org/en/download/

查看装置版本:

$ node -v

NPM 的装置

Node.js 内置了 NPM 包管理工具,无需独自装置。

查看装置版本:

$ npm -v

降级 npm 到最新版本:

$ npm install npm -g

配置 NPM 应用淘宝镜像源

长期应用
$ npm install express --registry https://registry.npm.taobao.org
永恒应用
$ npm config set registry https://registry.npm.taobao.org
$ npm config get registry
$ npm info express

复原为原来的官网地址

$ npm config set registry https://registry.npmjs.org
应用 cnpm 代替
$ npm install cnpm -g --registry=https://registry.npm.taobao.org
$ cnpm install express

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理