undefinedfix
Sign in

Yarn global installed package cannot be used globally?

Justin edited in Sun, 15 Jan 2023
yarn add global @tarojs/cli

The installation is completed, but the taro command shows that there is no such command. Just use NPM to install. Why?

1 Replies
fearhack
commented on Sun, 15 Jan 2023

Change the order of the command parameters. Global comes first and add comes second

//这实际还是把cli安装在局部环境
yarn add global @tarojs/cli
//这样才是安装到全局环境
yarn global add @tarojs/cli

Taro is locally installed in the node where the command is executed_ The modules directory and the bin directory are not configured to the environment variable% path%. Naturally, they cannot be used through taro. If yarn is installed as a binary installation package, the global path should be configured to the environment variable% path% by default. If taro is not found, the environment variable is missing. By default, yarn will place the taro command in the / C / users / user name / appdata / local / yarn / bin / directory, so you need to configure this path to the environment variable% path% '/ / query the yarn global bin path yarn config Current @ findstr global folder with the following command`