zoukankan      html  css  js  c++  java
  • 浅析如何升级vue-cli以及使用npm卸载包时遇到问题:npm ERR! code EEXIST(npm ERR! File exists: D:Program odejs ode_globalvue-list.cmd

      我的 vue-cli 还是 2.9.6,想建个 vue3 项目但是需要 vue-cli 4.5.0 以上,因为开始升级 vue-cli 之旅。

      使用 npm install -g @vue/cli 升级显示成功之后,查看 vue -V 还是 2.9.6,不知道什么原因。后来查到说需要先卸载旧版本,再安装,所以试一下。

    一、卸载旧版本

      卸载命令:npm uninstall -g vue-cli

      网上有人说,可以记一下:这里有坑,如果明明卸载了却仍出现报错类似提示没有卸载干净,可能是当时安装旧版本时你还使用了 yarn 导致有残留,用 yarn uninstall -g vue-cli 清理干净。

      我是卸载时遇到这个问题,总是报错:

    PS D:modb-frontmicro_front> npm uninstall -g vue-cli
    ......
    
    npm ERR! path D:Program
    odejs
    ode_globalvue-list.cmd
    npm ERR! code EEXIST
    npm ERR! Refusing to delete D:Program
    odejs
    ode_globalvue-list.cmd: 
    is outside D:Program odejs ode_global ode_modulesvue-cli and not a link npm ERR! File exists: D:Program odejs ode_globalvue-list.cmd npm ERR! Move it away, and try again. npm ERR! A complete log of this run can be found in: npm ERR! D:Program odejs ode_cache\_logs2021-10-12T10_21_55_195Z-debug.log

      报错其实也比较明显,要我删除 D:Program odejs ode_globalvue-list.cmd 这个文件,然后再试

      删除之后再试,又会报一些其他的文件存在,也是根据提示删除之后,再试即可,最后就可以卸载成功了。

      下面卸载 weexpack 时也是遇到同样问题,按上面提示操作一个个删除,就可以卸载成功。

    PS D:modb-frontmicro_front> npm uninstall -g weexpack
    npm ERR! path D:Program
    odejs
    ode_globalweexpack.cmd
    npm ERR! code EEXIST
    npm ERR! Refusing to delete D:Program
    odejs
    ode_globalweexpack.cmd: 

    is outside D:Program odejs ode_global ode_modulesweexpack and not a link npm ERR! File exists: D:Program odejs ode_globalweexpack.cmd npm ERR! Move it away, and try again.
    PS D:modb-frontmicro_front> npm uninstall -g weexpack
    removed 1 package in 3.084s

    二、安装新版本

      自3.0版本后,官方声明(https://cli.vuejs.org/zh/guide/installation.html)这个工具改名为 @vue/cli。

      安装命令:

    npm install -g @vue/cli
    // OR
    yarn global add @vue/cli

      需要注意一下 Node 版本要求:Vue CLI 4.x 需要 Node.js v8.9 或更高版本 (推荐 v10 以上)。你可以使用 n,nvm 或 nvm-windows 在同一台电脑中管理多个 Node 版本。

    三、检查新版本

      打开终端输入命令行:vue -V(是大写V,不是小写)或 vue --version,如下显示 @vue/cli 4.5.13 说明安装成功。

      当然这里安装新版本 vue-cli ,检查新版本也出现一个问题,可以看下篇博客了解。

  • 相关阅读:
    28完全背包+扩展欧几里得(包子凑数)
    HDU 3527 SPY
    POJ 3615 Cow Hurdles
    POJ 3620 Avoid The Lakes
    POJ 3036 Honeycomb Walk
    HDU 2352 Verdis Quo
    HDU 2368 Alfredo's Pizza Restaurant
    HDU 2700 Parity
    HDU 3763 CDs
    POJ 3279 Fliptile
  • 原文地址:https://www.cnblogs.com/goloving/p/15399154.html
Copyright © 2011-2022 走看看