简体   繁体   English

Vue:安装@vue/cli 后找不到命令

[英]Vue : command not found after installing @vue/cli

I don't know why isn't working for me.我不知道为什么对我不起作用。 I opened powershell as administrator and run npm install -g @vue/cli .我以管理员身份打开 powershell 并运行npm install -g @vue/cli I have done uninstalling vue-cli and restalling again doesn't work.我已经卸载了 vue-cli 并且再次重新安装不起作用。 Here is my error这是我的错误

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>

%APPDATA%\\npm添加到PATH修复了我的问题

install using sudo 使用sudo安装

sudo yarn global add @vue/cli sudo yarn global add @ vue / cli

At windows:在窗口:

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

in environment variable在环境变量中

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

install yarn or npm安装纱线或 npm

third step: run window shell as administrator第三步:以管理员身份运行window shell

set-executionpolicy unrestricted设置执行策略不受限制

Forth step : yarn global add @vue/cli第四步:纱线全局添加@vue/cli

Result:结果:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM