我的环境:
- OS: Ubuntu 20.04
- Yarn: 3.1.1
- Node: v16.12.0
Run Code Online (Sandbox Code Playgroud)
说明链接: https: //cli.vuejs.org/guide/installation.html
当我运行命令时:yarn global add @vue/cli
我收到错误:
Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Run Code Online (Sandbox Code Playgroud)
该文档包含yarn v1 的说明。
Yarn v2及以上版本不再支持使用全局参数。您可以在此处
查看他们的迁移指南。
每次你想用 vue 运行命令时,你都可以使用yarn dlx。或者,您可以使用 npm 安装 vue cli:
npm install -g @vue/cli
Run Code Online (Sandbox Code Playgroud)