`vue-cli-service`不是内部或外部命令,解决方案


主要原因是vue-cli-service未安装

初始化

npm install

此时默认的镜像地址是https://registry.npmjs.org
因为代理问题部分组件无法正常下载,即安装异常

方法一

将镜像设置为淘宝的镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install  

安装完成后

npm run dev  

会看到成功了。

方法二

删除node modules ;重新安装 node modules;
如果没有 则 单独安装 vue-cli-service;

npm install vue-cli-service -S

方法三

npm install -g @vue/cli 

方法四

yarn add vue-cli-service -S

安装过程中

cnpm install yarn

会提示

error An unexpected error occurred: "https://registry.npm.taobao.org/vue-cli-service: Not found".

设置镜像为默认的

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

或者

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

安装

cnpm install yarn
yarn add vue-cli-service -S

安装完成后

  npm run dev 

成功了。

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐