重装vue脚手架

vue 脚手架目录如下:

C:\Users\用户名\AppData\Roaming\npm

存在如下文件,当如下文件被当成垃圾清理之后,vue脚手架将无法运行。

重装vue脚手架

在cmd中运行vue init wepack  hello将出现如下错误

 无法将“vue”项识别为 cmdlet、函数、脚本文件或可运行程序的名称' 或 'vue不是内部或外部命令'

重装步骤如下:

1.快捷键Win + R  输入cmd 打开命令提示窗口

2.运行 node -v  显示node版本号,运行 npm -v   显示npm版本号 代表node.js已安装。

3.运行 npm cache clean --force 清理缓存

        没有清理缓存会出现如下错误

       npm ERR! Unexpected end of JSON input while parsing near '...tarball":"https://reg'

4.运行 npm set registry https://registry.npmjs.org/  如无反应

运行淘宝镜像 npm install -g cnpm --registry=https://registry.npm.taobao.org

5.运行 npm install webpack -g 安装打包工具

6.运行 npm install vue-cli -g 安装vue脚手架

安装完成

运行 vue init webpack-simple hello 新建vue项目