Need help deploying react application with netlify - reactjs

Not familiar with how to use netlify. Im trying to deploy this app
https://github.com/Rshauneb/real-estate
my build command is:
npm run watch
but every time I try to deploy my site I keep getting this error.
"failed during stage 'building site'"
Any suggestions?

Mimic what Netlify is doing in the build using their build bot.
Clone your project into a clean directory from GitHub
npm install
npm run watch
If you do not get an error, you may have a global command or setting that does not get set on Netlify. Without more information, this is the only answer possible.
Here is the error I found when I did the above:
Problem #2
Watch is a command for local development, so you should not be using npm run watch as a build command on Netlify. You will need to run the command to build your site into a directory for deploy and use that directory for your "Deploy directory".

Related

getting error when run npm start command with gatsby

When I run command npm start it's giving me error
ERROR
gatsby develop
Start development server. Watches files, rebuilds, and hot reloads if
something changes
And when I run command gatsby build it's giving me this error:
gatsby can only be run for a gatsby site. Either the current
working directory does not contain a valid package.json or 'gatsby' is
not specified as a dependency
I tried to delete node_modules and install again but still giving me the same error. How can I fix this?
It seems that you are not running the commands in the proper folder.
npm start, gatsby develop or gatsby build must be triggered in the root of your Gatsby project, where the package.json is located.
Share more details about where and how are you trying to run npm start and even your project structure in order to know what's going on.

how do you clone a git Gatsby project and run it locally?

I'm familiar with cloning git projects.
But I'm struggling to clone a Gatsby project, https://github.com/MunifTanjim/gatsby-theme-dox, and then run the website locally.
I run git clone https://github.com/MunifTanjim/gatsby-theme-dox
Then it downloads
I go into the correct directly, and I've tried
gatsby build
This works
then
gatsby develop
I get the following error:
ERROR gatsby <develop> can only be run for a gatsby site.
Either the current working directory does not contain a valid package.json or 'gatsby' is
not specified as a dependency
I've also tried
I also cd into the demo folder and run the same -- I get it to run locally but with a 404 error...
Is it possible to run the demo of this gatsby project?
I'm quite new to Gatsby so trying to understand by starting with a prebuilt project.
Once you clone the repository you need to install the dependencies. cd to the root of your project and run npm install or yarn install.
gatsby build and gatsby develop, like all Gatsby commands, must be run in the root of your project, where the package.json is located. Otherwise, it will throw an exception.
In your case, run the following in order:
git clone https://github.com/MunifTanjim/gatsby-theme-dox
cd gatsby-theme-dox
npm install #or yarn install
cd demo
gatsby develop #to build the site in development mode
gatsby build && gatsby serve #to build the site in production mode
I'd suggest taking a look at Gatsby commands (gatsby-cli) to understand what you are running.
git clone https://github.com/MunifTanjim/gatsby-theme-dox.git
cd gatsby-theme-dox
yarn install
cd demo
gatsby develop (you should see the main page in http://localhost:8000/) or gatsby build and when it ends run gatsby serve in the terminal (see the main page in http://localhost:9000/)

How to give next js app build to the client

I am new on Next JS, I have created a small application. It is using API calls and more features.
During development, Using the command as npm run build I am able to create .next folder as build and using npm run start I am able to run that build.
Now the client is asking for build, so what should I send to him? Either complete project and ask him to do the
npm run build and npm run start (which I don't think so)
or only the .next folder. But how he will run this build?
Open package.json in your editor and add the following export script to the file:
"export": "npm run build && next export -o _static"
run this code in the terminal:
npm run export
Open _static folder and there is all of your file.
Some possible ways of sharing your project:
You can easily build and host your project with services like vercel or netlify. Easy and quick. Check out the vercel CLI in particular.
Your client can clone the git repo, install all dependencies, run build, and run start. This'll start a production server. Check here: https://nextjs.org/docs/api-reference/cli#production. Bad idea if your client is not a dev.
You can build your project and send the output to your client, which he/she can then view by spinning up a server (python simpleHTTPServer, Mamp). Also a bad idea if your client is not a dev.
Long story short, host your project somewhere and send them a production URL.

npm run deploy failure when deploying React app to Github

Problem:
I am still very new to React and am trying to push my React app onto Github, but I keep running into an error when I deploy it on my console.
Set Up:
I am using Atom on a Windows 10 computer. I created my React app by using the commands, npx create-react-app jordon. I then followed the steps in this youtube tutorial. This is what my package.json looks like after following the tutorial:
I then went through the steps to initialize a github repository. However, after running npm run deploy, I come across an error:
I have tried to rerun the steps in the tutorial time after time, but either receive the same error, or an error that is resolved by uninstalling gh-pages from the folder but leads to the same error. At this point, I have not found any resources that would help me, since most people seem to have successfully ran the npm run deploy command. Any help would be much appreciated!

Can't deploy my app to github-pages with react-create-app

I've recently finished building my app, using react-create-app, but I can't load it on github pages. It builds a production version without any problems, but whenever I enter "npm run deploy" into the console I get the following error:
Error: spawn git ENOENT
at exports._errnoException (util.js:1033:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:425:7)
at startup (bootstrap_node.js:146:9)
at bootstrap_node.js:540:3
I'll leave a link to my package.json since I can't seem to make it look neat here: https://github.com/Umbrella1234/movie-app/blob/master/package.json
Do you have any ideas how to make it work?
If you are using Windows, make sure you have installed Git for Windows from here.
Considering you have taken the previous steps correctly, after installing Git for Windows, running npm run deploy creates an optimized production build and deploy it on GitHub pages. If you haven't logged in to Github for windows app before, Github app pops up and asks you to enter your username and password. When you've done that the deploy process will continue and uploads the production build on GitHub pages.
Sometimes Windows Powershell or even 3rd-Party software have trouble integrating with git.
One solution is to use Git Bash or whichever tool you know has works when trying to make commits. Navigate to the app directory using cd and then type npm run deploy inside of git bash. This should be able to connect to github no problem and fix your error.

Resources