how to install npm yarn code example Example 1: install yarn npm install -g yarn Example 2: macos install yarn brew install yarn