Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 22, 2021 06:36 am GMT

Solution to Problems that Beginners Encounter ~React/Deploy~

I've been learning React only for three weeks, but I've had so many problems. I'll share one of them I encountered while I was deploying my project. It was not the same way I usually do since this time I was using API.

The project was to create a weather app using OpenWeatherMap, push the code to GitHub and deploy it to Netlify.
I hid the API key in a ".env" file with a variable name, just like this: VARIABLE_NAME_FOR_API = abcde12345

Here is what I needed to do:

Netlify

(1) Set Environment Variables
Deploys > Deploy settings > Environment
> Environment variables > Edit variables

 Key => VARIABLE_NAME_FOR_API value => abcde12345

(2) Set Build Command
Deploys > Deploy settings > Continuous Deployment
> Build settings > Build command

Build command => CI= yarn run build* You can change 'yarn' to 'npm' if you're using npm* Make sure it is capital i, and there's no space  between "CI" and "=". I typed "CI = yarn run build"   and failed so many times.

I hope this will help those who have the same problem.


Original Link: https://dev.to/ayako_yk/solution-to-problems-that-beginners-encounter-reactdeploy-1hag

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To