【问题标题】:Vue : command not found after installing @vue/cliVue:安装@vue/cli 后找不到命令
【发布时间】:2019-08-02 10:31:16
【问题描述】:

我不知道为什么不适合我。我以管理员身份打开 powershell 并运行npm install -g @vue/cli。我已经卸载了 vue-cli 并再次重新安装不起作用。这是我的错误

PS C:\WINDOWS\system32> npm install -g @vue/cli
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\Lin Aung\AppData\Roaming\npm\vue -> C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\@vue\cli\bin\vue.js

> protobufjs@6.8.8 postinstall C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\protobufjs
> node scripts/postinstall


> nodemon@1.18.10 postinstall C:\Users\Lin Aung\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @vue/cli@3.5.0
added 680 packages from 509 contributors in 172.749s
PS C:\WINDOWS\system32> vue
vue : The term 'vue' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ vue
+ ~~~
+ CategoryInfo          : ObjectNotFound: (vue:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS C:\WINDOWS\system32>

【问题讨论】:

    标签: vue.js vue-cli


    【解决方案1】:

    %APPDATA%\npm 添加到 PATH 解决了我的问题

    【讨论】:

      【解决方案2】:

      使用 sudo 安装

      sudo yarn global add @vue/cli

      【讨论】:

      • 问题出在 windows 上。
      【解决方案3】:

      在窗户上:

      第一步:%path%;%appdata%\npm;C:\Program Files\nodejs;C:\Users\User.npm-global;C:\Program Files (x86)\bin\

      在环境变量中

      第二步:https://classic.yarnpkg.com/en/docs/install/#windows-stable

      安装 yarn 或 npm

      第三步:以管理员身份运行window shell

      设置执行策略不受限制

      第四步:yarn global add @vue/cli

      结果:

      C:\Users\User>vue --version @vue/cli 4.5.15

      【讨论】:

        猜你喜欢
        • 2020-02-14
        • 2019-10-03
        • 2018-12-12
        • 2020-04-20
        • 2019-04-27
        • 2017-03-12
        • 2021-05-20
        • 2021-06-17
        • 2021-02-13
        相关资源
        最近更新 更多