标签 npm 下的文章

1、npm

设置为淘宝源:

npm config set registry http://registry.npm.taobao.org/

设置为默认源:

npm config set registry https://registry.npmjs.org/

2、yarn

设置为淘宝源:

yarn config set registry https://registry.npm.taobao.org

设置为默认源:

yarn config set registry https://registry.yarnpkg.com

nvm 常用命令
● nvm install stable 安装最新稳定版 node

● nvm install 安装指定版本,如:安装v4.4.0,nvm install v4.4.0

● nvm uninstall 删除已安装的指定版本,语法与install类似

● nvm use 切换使用指定的版本node

● nvm ls 列出所有安装的版本

● nvm alias default 如: nvm alias default v11.1.0

安装 arco-cli 之后无法在命令行使用 arco 命令,出现 command not found

在新主机安装 arco-cli 命令

npm i -g arco-cli

### 提示安装成功
added 628 packages, and audited 629 packages in 45s

51 packages are looking for funding
  run `npm fund` for details

16 high severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

在执行 arco 命令发生 arco: command not found

arco init arco-demo

zsh: command not found: arco

解决这个问题的方式如下:

1. 手动创建 .npm-global 文件夹

mkdir ~/.npm-global

2.修改 npm prefix

npm config set prefix '~/.npm-global'

3.将路径加入到环境变量

export PATH=~/.npm-global/bin:$PATH

4.重载 bash 配置文件

source ~/.zshrc

5.接着重新执行 -g 相关安装即可

如果以上步骤不成功,请重新安装npm

npm install npm@lastest -g