To install Shopify CLI 3 on your operating system, you must have installed Nodejs 14.x above, and NPM, that is all you need to install and run Shopify cli 3 on your system.
There are three npm packages that you can install for Shopify theme cli, apps cli, and hydrogen cli. We are giong to install nodejs, npm, yarn and then shopify cli, theme cli, apps cli and hydrogen cli.
Install Nodejs 14.x ^
You must have nodejs 14.x ^ preinstalled to install shopiyf cli, if you have not installed nodejs then visit nodejs.org and download the most stable version of nodejs on your system.

node -v
Install NPM, Yarn, PNPM, NPX
To install npm, npx, yarn, pnpm on your system, you can run the following commands with sudo if you are on linux like systems.
npm -v
npm i -g pnpm
npm i -g yarn
npm i -g npx
Install Shopify CLI 3.0 for Theme, App, Hydrogen
You must install shopify/cli base to install other theme, app, and hydrogen npm packages to use them for development.
npm i -g @shopify/cli
npm i -g @shopify/theme
npm i -g @shopify/app
npm i -g @shopify/cli-hydrogen
Login with Shopify CLI 3

To login to your devlopment store with Shopify cli 3, run the following command
shopify theme dev --store=storename
–store=xxxxxxxx
xxxxxxxxx.myshopify.com
shopify cli invalid target — error
To fix this error, you must give it your store name for the first time only and whenever you have to switch to a new store.
Make sure you are in shopify theme root folder
shopify theme dev --store=storename