Installing PWA with Magento 2 yarn error

Yarn error during the installtion


  MAGENTO_BACKEND_URL: Connect to an instance of Magento by specifying its public domain name. (eg.
     "https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/")
     CHECKOUT_BRAINTREE_TOKEN: Specify a Braintree API token to direct the Venia storefront to communicate with your Braintree instance. You can find this value in
     Braintree's Control Panel under Settings > API Keys > Tokenization Keys. (eg. "sandbox_8yrzsvtm_s2bg8fs563crhqzk")
  ⓧ  Error: Missing required environment variables:
     MAGENTO_BACKEND_URL: Connect to an instance of Magento by specifying its public domain name. (eg.
     "https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/")
     CHECKOUT_BRAINTREE_TOKEN: Specify a Braintree API token to direct the Venia storefront to communicate with your Braintree instance. You can find this value in
     Braintree's Control Panel under Settings > API Keys > Tokenization Keys. (eg. "sandbox_8yrzsvtm_s2bg8fs563crhqzk")
  ⓧ  Error: Error: Missing required environment variables:
     MAGENTO_BACKEND_URL: Connect to an instance of Magento by specifying its public domain name. (eg.
     "https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/")
     CHECKOUT_BRAINTREE_TOKEN: Specify a Braintree API token to direct the Venia storefront to communicate with your Braintree instance. You can find this value in
     Braintree's Control Panel under Settings > API Keys > Tokenization Keys. (eg. "sandbox_8yrzsvtm_s2bg8fs563crhqzk")

For this we have to add the following in the terminal

In Linux or Mac

export NODE_OPTIONS=--openssl-legacy-provider

Using PWA STUDIO For Magento

Follow the link
https://developer.adobe.com/commerce/pwa-studio/tutorials/setup-storefront/

arn basically stands for Yet Another Resource Negotiator. Developed by Facebook, Yarn is an extremely efficient packet manager that lets you share code with other developers.

When compared to npm, Yarn is more secure and reliable. It is because codes in Yarn are generally shared through packages, which are also being called modules.

Steps to Install Yarn

Like Magento 2, there are many ways to install Yarn. But since we’re using Ubuntu as the operating system, we will be installing Yarn through the Debian package repository.

Execute the below command to configure the Debian repository:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -echo “deb https://dl.yarnpkg.com/debian/ stable main” | sudo tee /etc/apt/sources.list.d/yarn.list
NOTE: If you’re using Ubuntu 16.04 or a below version, it is compulsory to configure the source code repository by using the command below.

sudo apt-get update && sudo apt-get install yarn
One more thing you need to remember is that Yarn may or may not be located in your path. Therefore, it is recommended to verify and add the path so that you can run it without any interruption.

Path Setup for Yarn

Add the following command to your profile, which can be in .bash_profile, .profile, .bashrc, etc.

export PATH=”$PATH:/opt/yarn-[version]/bin”
Next, you need to test if Yarn is installed properly or not.

To test the Yarn installation, execute the following command:

yarn –version
If you face any error or issue during the installation of Yarn, we highly recommend looking into GitHub for possible solutions.

Leave a comment

Your email address will not be published. Required fields are marked *