Unable to deploy react application to github pages - javascript

I am trying to deploy a simple react application, it worked the first time, but when i updated my code to github repo and tried to run 'npm run deploy', it failed
Below is my package.json
I am new to react and deploying apps to server

First, make sure to use the latest version of npm, as seen here, and in npm/npm issue 7768
Second, looking at the history of your AJ555/react-exp, gh-pages branch, start by reverting the last two commit (to get back to the state where the first deployment succeeded), and check if it is still working.
If it does work, then the issue is in the current last two commits.

I have this problem as well. What I do is restart my computer and then try run npm run deploy again.

Related

Unable to deploy react application to heroku

so I just finished building the beta version of my e-commerce application and decided to deploy to heroku from my github repository.
The first issue I ran into was not npm run build (which I did then pushed it to github) then redeployed.
Next issue was my build failed because I didn't specify the version of node. (SO i want into the package.json and typed in...)
"engines": {
"node": "16.14.2"
},
Again, redeployed I got through the build and I thought all was well. BUT I get an application error (fun) and so I go into heroku logs to see what I did wrong. Problem is I actually don't know what i did wrong. This is what the log says

React Storybook blank page when run

I am trying to load the demo storybook stories.
I created a react app using create-react-app and run npm start. It starts on port: 3000.
Then when I run npm run storybook, it opens a browser on port:6006. But displays a blank page only.
What helped me was to run
rm yarn.lock
yarn install
after installing storybook into my project
Apparently react has upgraded to version 17.0.0, but storybook hasn't made the switch yet.
If you take version 16.14.0 of react it should work.
https://www.youtube.com/watch?v=fjb_QcQhRrs
If you wanna stay on react version 17 then you could upgrade storybook to prelease by doing
npx sb#next upgrade --prerelease
for additional information please refer GitHub issue #12408
Try to clear your browser cache. It resolved my issue.
npm ci saved the day for me and fixed the issue
My problem was because I updated #storybook/preset-create-react-app too and it seems I shouldn't have.
When #storybook/preset-create-react-app was reverted back to initial version 3.2.0 in my case, and #storybook/react updated to latest ^6.5.4 - everything was fine.

How do I run a copied project in Node.js

https://github.com/gleitz/mahjong
I want to run this app on my windows,
the directions say:
-Install dependencies with npm update
-Start the application with node app.js
it's sound easy so I try myself.
1.Fist of all , I install node.js on it's official website (https://nodejs.org/en/)
I download the 8.9.3 version.
after installing node.js
2.open the command line and go to the project path.
3.then I input the command npm update.
it works,and the node_modules folder is created.But there are some warn message
4.finally input the command node app.js... it's not work with many error message
following is wrong message
I wonder know how should I do.Is any thing I didn't installed?
Please help me.I really want to research this mahjong project.
Before running npm update in the directory where you have your project, you should run npm install first to install all the required dependencies needed for the project to run.
So I advice to delete the node_modules directory that was created after you ran npm update, after which you can then run npm install. This should solve your issue.
Update: If you just want to try it online and not run it locally they've hosted a version on the web: http://gleitzman.com/apps/mahjong.
It's not your fault.
What you did was correct, but the project documentation needs to be updated. It's not a turn-key solution and you'll need to figure a few things out to get it working.
The error message is says it wants a mongo db instance, but you don't have one running. Try the mongodb home page or google for instructions. If you have docker it is pretty easy: docker run -it -p 27017:27017 mongo.
Even after spinning up mongodb I wasn't able to get the app to work locally. You could try contacting the repo maintainer for assistance. They may be happy to help given you've shown interest in their project.
Good Luck!

Is it possible to run React project without npm start?

I'm in a big trouble. Working in a part time in a company they're looking for a new web technology to build "web-component" in their website.
They have started to use AngularJS (first version) and I told them that, with the recent evolution of this framework, it's not the right period of time to deal with it.
That's why I began to be interested in ReactJS. However, they don't have a node.js server infrastructure (and that's why AngularJS suits to them, only one browser is sufficient) so it's impossible to run it with something like "npm start".
SO ! My question is (as my post's title says...) :
Is it possible to run ReactJS without server side ?
I've tried with the following line in my header
<script src="https://unpkg.com/react#15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom#15/dist/react-dom.js"></script>
But it remains a blank page.
Maybe there is something I don't understant in the react structure and that's why I'm looking for some help/explanations from you.
I hope I have been clear enough ! Thank you in advance for answer.
It is absolutely possible to run a React app without a production node server. Facebook provides an easy-to-use project bootstrapper that you can read about here
That being said, developers may need to use a node dev server locally via npm start, as well as using node to perform production builds via npm run build. But one can take the build output from npm run build and serve it from any static server and have a working react application.
For those who are getting 404's after deploying in a sub directory. Make sure to add the path in package.json as homepage.
"homepage": "https://example.com/SUB-DIRECTORY",
You should insert "homepage": "./" into your package.json file, then use building react-script command like npm run build.
I did it by using serve, as part of the build step in Jenkins. To install it, execute the command:
npm install -g serve
Then, to serve it:
serve -s build
Please, refer to project page for more information: https://github.com/zeit/serve

Project broken by unidentified subdependency: how to recover? How to `npm install` with all packages limited by a date?

My project is successfully deployed via CI and working fine. But when I build it from the same commit locally, the project freezes without any error message. It's a huge Ember app with an enormous pipeline, and I've exhausted all my debugging ideas.
My only guess so far is that an npm subdependency update has broken something. I don't know which package is to blame. :(
I have no npm-shrinkwrap.json. I tried to introduce shrinkwrapping to the team, but it was causing too much trouble, so we went back to not using it.
No other team member has an up to date version of the project locally, so I don't have anyone to ask for a fresh npm-shrinkwrap.json.
I know the date at which the project was building correctly.
How do I tell npm to install every package (including subdependencies) limited by a date (in addition to restrictions specified in package.json files)?
If I were able to do that, I could see if the project starts working again. If it does, I could shrinkwrap and identify the troublesome package.
Any other suggestions to recover from this failure are also very welcome.
PS I'm using NVM, so I've tried both npm v2 and v3 -- same result.

Categories

Resources