React localhost:3000 Not Working after restarting the pc [closed] - reactjs

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I'm new to react and started learning it recently. Last day I created my 1st app and I was able to see it in the localhost:3000 before taking a break I bookmarked the page and shut down my pc.
Now when I try to access localhost:3000 it show me that it cannot connect. So I tried to use the "npm start" command in visual studio code terminal. But I received several errors and still trying to figure out how to start again the development server.
Any idea how to fix it?

I solved the problem. The fact is that react created inside the project a folder called js inside it there is a package.json that has this small code
{
"dependencies": {
"tar": "^6.1.11"
}
}
when i restarted the visual studio my location in terminal was inside the js folder so when I was trying to run the npm start command it wasn't working.
The fact is that react creates also another folder called my-app inside this one there is another package.json file. So in my case the solution was to move inside the my-app folder using cd. Attention the - symbol how spaces cannot be freely used inside the terminal. So the right way to navigate inside was
cd 'my-app'
if you don't use the quotes it will throw an error. now that I was inside the real app folder I was able to start the server using
npm start
This is a little bit strange and react devs need to add this fact in the documentation. Considering it automatically creates 2 folders and 2 package.json files making it confusing for newbie people like me

Related

How can I fix an issue with create-react-app where only node_modules, package.json, and package-lock.json are created?

I know there are other previous posts on this. However, they are from a few years ago, making them somewhat outdated. The issue I am having just started as of May 2, 2022.
If I run npx create-react-app my-app, the only thing that gets created is the folder and two files mentioned in the question title. I've spent over an hour trying previous solutions to other questions and using other sources, but the issue is still not resolved. I was wondering if anyone could help me?
Thanks
This is hard for me to answer without knowing the stack you have installed on your computer, however based on the information provided, you could be on your way!
From your terminal, I would try to navigate into the new app by:
`cd my-app`
Then, to start the server, run:
`npm start`
Here are some resources that I think will help you in your scenario:
https://reactjs.org/docs/create-a-new-react-app.html
Good luck buddy!

react npm start / yarn start not updating. I have to start and stop

I have recently stumbled upon this exploring this boilerplate. I believe it's a bit abandoned now, but figured i'd explore it.
https://github.com/react-boilerplate/react-boilerplate
Currently if i update the global-css file it appears to update automatically upon save, but any other file will not. Maybe this is due to the scaffolding or structure in what's being watched.
Would love some guidance. (newbish)

how to properly push to github using build? [duplicate]

This question already has answers here:
Blank page after running build on create-react-app
(17 answers)
Closed 1 year ago.
I'm a newbie to both git and AWS.
I bought a domain using AWS and have connected it to a Github repository.
I pushed the app to repository without initiating an npm run build.
After realizing that the website was showing the readme.md instead of the index.html which is inside of the public folder (not that that's working either), I decided to try to run npm run build and push that to the github repository, thinking that maybe that could fix my issue.
The problem I ran into was that /build is ignored inside .gitignore.
So I'm not sure if I should remove /build from .gitignore or find a work around, or something else I'm not aware of?
I would really appreciate some explanation from someone on that issue.
Thank you in advance.
So, there are 2 different things that we must break down from this question . One related to git itself and other is to the app build.
.gitignore tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc. It basically does keep track of the specified file or directory
More related to that can be found in here:
http://git-scm.com/docs/gitignore.
Now, going to the original problem (which is building your app) github does have a CICD pipeline called github actions which essentially allows you to create a workflow based on a template that can help building your app. Therefore the build can be done when your is code is pushed, without have to send unnecessary files to your remote repository from your local npm run build. (You can find more related to this subject in this link:
https://docs.github.com/en/actions/guides/building-and-testing-nodejs?learn=continuous_integration)
That doesn't necessary solves your issue with your App (because we are not discussing anything related to coding), but if your problem is just building the app that would be a starting point.
My other recommendation would be also to check more on how git/github actually works and how you can take advantage of these systems in the future to deploy/control your code.
Hopefully this can help!
Found the answer to my question here. Thanks for the help guys.
Blank page after running build on create-react-app

Unable to run React Native Project on simulator after updating to Xcode 12 [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I just updated to Xcode 12 and now my react native project (which was working just before updating) will not run and outputs this error
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
info Launching "app.lfgo.release"
error Failed to launch the app on simulator, An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=4):
The request to open "app.lfgo.release" failed.
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
The operation couldn’t be completed. Application info provider (FBSApplicationLibrary) returned nil for "app.lfgo.release"
Application info provider (FBSApplicationLibrary) returned nil for "app.lfgo.release"
The same was happening to me when upgraded to Xcode 12. What helped was to (if using lock files) install #react-native-community/cli-platform-ios as devDep and bump version in all #react-native-community/cli-platform-ios entries in yarn.lock file to 4.13.0
Not sure why this fixed it for me or anything about it but...
Using npx react-native run-ios throws this error for me, but when i built through xcode it worked fine. Makes no sense to me but oh well...

npx create-react-app not working "Must use import to load ES Module:" [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I've tried reinstalling node and removing appdata/roaming/npm and npm-cache. I've created several apps before so i'm not sure what's going on. Any help is appreciated.
this issue is fixed with 2.2.2 version of is-promise package. If you still experience problems creating new CRA, consider npm install -g --force create-react-app
If even then bug is still present, please comment your issue to this github issue
I would:
Restart the machine. Ensure you log out of your session if needed
Re-install Create React App
Uninstall yarn and reinstall
Reinstall node, ensure you use a newer version
Use a different network connection, maybe something is being blocked by a firewall
I would: change my node version.
Refer the following link
I read up on all the comments saying that this seems to be a recurring problem, and perhaps a temporary one. I looked at Bloodshot the movie and came back, tried again and it now works. Only thing i changed was trying it in a different folder (which i did multiple times before). Perhaps it was Vin diesel doing some magic or there was some problem with npm. Not sure but it works now and im thankful for it, and all the responses.

Resources