本文介绍: 以后安装直接采用cnpm替代npm例如原生npm命令为:npm install uniq —savecnpm命令为:cnpm install uniq —save运行VUE项目时,出现npm ERR!以后安装时,依然用npm命令,便可以由国内镜像下载。直接安装cnpm ,并更改服务器地址淘宝的国内地址替换npm仓库地址为淘宝镜像地址。

运行VUE项目时,出现npm ERR! A complete log of this run can be found in:报错时,以下解决方案

这是我的nodejs版本

解决方法

1. 删除项目node_modules 依赖

 

2. 执行 npm cache clean –force 清理缓存

3. 在项目文件夹执行npm install

4.执行npm run即可

加快npm下载速度(以下所有的操作最好在你安装node目录之下进行操作):

npm拉取依赖需要访问国外服务器,往往速度较慢,可通过以下两种方法使用国内镜像源:

方法一:

直接安装cnpm ,并更改服务器地址为淘宝的国内地址

命令

npm installg cnpmregistry=https://registry.npm.taobao.org

以后安装直接采用cnpm替代npm例如原生npm命令为:npm install uniq –savecnpm命令为:cnpm install uniq –save

方法二:

替换npm仓库地址为淘宝镜像地址

命令

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

查看是否更改成功:

npm config get registry

以后安装时,依然用npm命令,便可以由国内镜像下载
 

 

发表回复

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