npm install -g @vue/cli 报错

npm install -g @vue/cli 报错

LXJ@DESKTOP-U0I6DR1 MINGW64 /c/code/vue_demo

$ npm install -g @vue/cli

npm WARN deprecated @hapi/joi@15.1.1: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated @hapi/address@2.1.4: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained

npm WARN deprecated har-validator@5.1.5: this

npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

npm WARN @vue/compiler-sfc@3.0.5 requires a peer of vue@3.0.5 but none is installed. You must install peer dependencies yourself.


npm ERR! code EEXIST

npm ERR! path C:\Users\LXJ\AppData\Roaming\npm\vue.ps1

npm ERR! Refusing to delete C:\Users\LXJ\AppData\Roaming\npm\vue.ps1: is outside C:\Users\LXJ\AppData\Roaming\npm\node_modules\@vue\cli and not a link

npm ERR! File exists: C:\Users\LXJ\AppData\Roaming\npm\vue.ps1

npm ERR! Remove the existing file and try again, or run npm

npm ERR! with --force to overwrite files recklessly.


npm ERR! A complete log of this run can be found in:

npm ERR!     C:\Users\LXJ\AppData\Roaming\npm-cache\_logs\2021-02-13T15_36_28_517Z-debug.log

尝试过的解决方式:

试过很多网上的解决办法,还是不管用

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
Brian 2021-02-16 12:04:30

 C:\Users\LXJ\AppData\Roaming\npm\vue.ps1: is outside C:\Users\LXJ\AppData\Roaming\npm\node_modules\@vue\cli and not a link


你看看这下面的这些目录中的文件,尝试手动删除,然后把

C:\Users\LXJ\AppData\Roaming\npm\ 这个目录设置成所有人都可以读写的权限


最后,使用cnpm淘宝源进行安装@vue/cli

  • 提问者 qq_麥麥糖_0 #1

    cnpm装上了?,但是装@vue/cli 还是报错?

    LXJ@DESKTOP-U0I6DR1 MINGW64 /c/code/vue_demo

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

    npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

    npm WARN deprecated har-validator@5.1.5: this

    C:\Users\LXJ\AppData\Roaming\npm\cnpm -> C:\Users\LXJ\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm

    + cnpm@6.1.1

    updated 3 packages in 10.831s



    LXJ@DESKTOP-U0I6DR1 MINGW64 /c/code/vue_demo

    $ cnpm install -g @vue/cli

    C:\Users\LXJ\AppData\Roaming\npm\node_modules\cnpm\node_modules\is-type-of\index.js:1




    SyntaxError: Invalid or unexpected token

        at wrapSafe (internal/modules/cjs/loader.js:979:16)

        at Module._compile (internal/modules/cjs/loader.js:1027:27)

        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

        at Module.load (internal/modules/cjs/loader.js:928:32)

        at Function.Module._load (internal/modules/cjs/loader.js:769:14)

        at Module.require (internal/modules/cjs/loader.js:952:19)

        at require (internal/modules/cjs/helpers.js:88:18)

        at Object.<anonymous> (C:\Users\LXJ\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:4:12)

        at Module._compile (internal/modules/cjs/loader.js:1063:30)

        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)


    2021-02-18 11:37:17
  • 提问者 qq_麥麥糖_0 #2

    用yarn装成功了,不过不知道对后面的步骤会不会有问题

    2021-02-19 20:47:11
  • Brian 回复 提问者 qq_麥麥糖_0 #3

    我感觉是你的源的问题,或者说是网络的问题,npm安装目前的版本比yarn来说,有的时候会更快

    2021-02-25 09:39:46
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师