初始文档
This commit is contained in:
47
开发文档/javascript/nodejs.md
Normal file
47
开发文档/javascript/nodejs.md
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
# nvm版本管理器常用命令
|
||||
|
||||
```shell
|
||||
nvm arch #显示node是以32位还是64位运行
|
||||
nvm check #检查nvm4w进程是否存在问题
|
||||
nvm current #显示活动版本
|
||||
nvm install <version> [arch] # 安装指定版本的node,也可以指定32位或64位
|
||||
nvm list [available] # 列出node安装的版本,末尾加available可以显示可安装的版本
|
||||
nvm on #启用node版本管理
|
||||
nvm off #禁用node版本管理
|
||||
nvm proxy [url] # 设置下载代理,留空查看当前代理,设置none删除代理
|
||||
nvm uninstall <version> #删除特定版本
|
||||
nvm use <version> [arch] # 切换到指定版本
|
||||
nvm root <path> # 设置nvm存放不通版本node的目录
|
||||
nvm version # 显示当前运行的nvm的版本
|
||||
nvm node_mirror <node_mirror_url> # 设置节点镜像https://npmmirror.com/mirrors/node/
|
||||
nvm npm_mirror <npm_mirror_url> # 设置npm镜像,https://npmmirror.com/mirrors/npm/
|
||||
```
|
||||
# npm安装模块
|
||||
```js
|
||||
npm install -g --save-dev --verbose crypto
|
||||
//-g参数:全局安装
|
||||
//--save-dev:保存到当前项目模块目录
|
||||
//--verbose:安装时显示进度条
|
||||
```
|
||||
# npm安装加速
|
||||
```shell
|
||||
# 设置华为镜像加速
|
||||
npm config set registry https://repo.huaweicloud.com/repository/npm/
|
||||
npm cache clean -f
|
||||
# 设置nodejs工具的镜像地址
|
||||
npm config set disturl https://repo.huaweicloud.com/nodejs
|
||||
# 设置Node-Sass的镜像地址
|
||||
npm config set sass_binary_site https://repo.huaweicloud.com/node-sass
|
||||
# 设置浏览器引擎驱动镜像地址,
|
||||
npm config set phantomjs_cdnurl https://repo.huaweicloud.com/phantomjs
|
||||
npm config set chromedriver_cdnurl https://repo.huaweicloud.com/chromedriver
|
||||
npm config set operadriver_cdnurl https://repo.huaweicloud.com/operadriver
|
||||
# 设置Electron和Python的镜像地址
|
||||
npm config set electron_mirror https://repo.huaweicloud.com/electron/
|
||||
npm config set python_mirror https://repo.huaweicloud.com/python
|
||||
```
|
||||
# yarn安装加速
|
||||
```shell
|
||||
yarn config set registry https://repo.huaweicloud.com/repository/npm/
|
||||
```
|
||||
Reference in New Issue
Block a user