来自 技术 2019-03-16 的文章

ubuntu 18.04 使用 nvm 安装 nodejs

开发十年,就只剩下这套架构体系了!>>>

20190315 使用 nvm 安装 nodejs1、 找到 nvm 官网帮助

https://github.com/creationix/nvm

我习惯于 terminal 操作,所以选择 git install ,帮助文档如下https://github.com/creationix/nvm#git-install

2、下载 nvm、install

mkdir nvmcd nvm/wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash提示内容:=> Downloading nvm as script to '/home/dhbm/.nvm'=> Appending nvm source string to /home/dhbm/.bashrc=> Appending bash_completion source string to /home/dhbm/.bashrc=> Close and reopen your terminal to start using nvm or run the following to use it now:export NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion3、设置环境

按照提示,直接 copy 粘贴以上内容export NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion确认 nvmcommand -v nvm返回结果:nvm4、安装 nodejs

nvm install node返回内容如下:Downloading and installing node v11.11.0.....确认 nodejs 和 npm 版本node --version返回结果:v11.11.0 npm -v6.7.05、设置 淘宝镜像代理

获取当前 npm 代理npm get registry返回结果:https://registry.npmjs.org/设置淘宝镜像代理npm config set registry http://registry.npm.taobao.org/恢复 npm 代理npm config set registry https://registry.npmjs.org/6、安装 cnpm

npm install cnpm -g查看版本号cnpm -v返回结果:cnpm@6.0.0 (/home/dhbm/.nvm/versions/node/v11.11.0/lib/node_modules/cnpm/lib/parse_argv.js)npm@6.9.0 (/home/dhbm/.nvm/versions/node/v11.11.0/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)node@11.11.0 (/home/dhbm/.nvm/versions/node/v11.11.0/bin/node)npminstall@3.20.2 (/home/dhbm/.nvm/versions/node/v11.11.0/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)prefix=/home/dhbm/.nvm/versions/node/v11.11.0 linux x64 4.15.0-46-generic registry=https://registry.npm.taobao.org7、安装 yarn

经常有 npm 找不到的包, npm淘宝镜像和 cnpm 也不管用所以,也安装一个 yarn 备用npm install -g yarn查看版本号yarn -v1.13.0同样设置一下 yarn 淘宝镜像代理yarn config set registry http://registry.npm.taobao.org/yarn config set registry https://registry.npm.taobao.org -g yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

标签:   npm      CNPM      Linux      Yarn      Bash-Complet      c#做安卓服务器端      innodb启动   
上一篇:如何从.pfx文件中提取私钥和证书
下一篇:没有了