npm start in React app opens different url unpredictably - reactjs

Tried to run npm start on a project I hadn't looked at in a couple weeks and when I did it opens up localhost:3000/myname/partofmyprojectname instead of just localhost:3000/
When I go to localhost:3000/ there's an error in my terminal
Really confusing because it worked last time I tried it and I didn't change anything I don't think.

As I was making this question I found the solution from this post:
In my package.json, "homepage"'s value was the path to the readme in the github repo: "https://github.com/myname/my-app-frontend#readme" (don't know how that happened). I just changed that to '/'.
I'm thinking maybe my version of react-scripts updated and npm start was deferring to the homepage key in the package.json but not totally sure.

Related

I am having weird issues with "#sveltejs/kit": "^1.5.0" but not 1.0.0. Is there any way to tell what might be causing these?

I have a SvelteKit app with package.json showing "#sveltejs/kit": "^1.0.0" and it uses netlify functions to interface with mongodb and everything works fine.
I then installed, in another folder, npm create svelte#latest app and it shows "#sveltejs/kit": "^1.5.0". Everything else the same. Copied over src/static/netlify folders, installed Netlify adapter, set up netlify.toml file, .env file. Installed same version dependencies.
Under 1.5, I get several weird problems like it wont update a record or it has an issue with a {#each loop or duplicate keys. Not just one issue. Several. I change package.json entry to "#sveltejs/kit": "^1.0.0" and npm i and all the problems disappear so its definitely 1.5. I updated Node. No difference. I updated axios and mongodb and same issue.
Is there any way to find out what changes took place from 1.0 to 1.5 to try to figure this out? I would like to use the latest SvelteKit version but can't with these errors.

Fork pancakeswap frontend

Trying to fork pancakeswap from https://github.com/pancakeswap/pancake-frontend.
Steps what I did,
Clone Repo
Run npm install command
Run npm start command
Solve some no-used props error by commenting that props. After that also 2 errors are still in application.
Error1: JSX props should not use functions react/jsx-no-bind
Error2: defaultProp "expanded" has no corresponding propTypes declaration react/default-props-match-prop-types
Help me to solve this. Stuck more than 5 days. Searched many pages but no use. Most of them are suggested to change jsx functions. Is there is any simple way to solve these errors?
I did the same yesterday and it worked. There are still some elements that I need to figure out, but to make it running on localhost wasn't hard.
Before running pancakeswap frontend we need to have nodejs installed. Should work with any version 16, my was v16.14.0. Second is to have installed yarn as they don't use npm. This we know because the project has yarn.lock file. Third is have nextjs installed globally like yarn. With this we should be able to install and run the app.
Next steps would be:
Clone repo or just download it, will work as well
Run yarn install command (or just yarn - works the same)
Run yarn build (this will call next build)
Run yarn start (this will call next start)
After last step the app should start on localhost:3000
This is what I did and it worked. Keep in mind that this is valid for the current version and could change in future.

Updating create-react-app app, but cannot find react-scripts in package.json

The title says it all.
To update my app, which was made with create-react-app, I have to update react-scripts. But, I cannot find this in my package.json. I've even tried installing it manually even though it was not there in the first place and should have been. No luck. Any ideas?
can you upload s screenshot what is the message they show you once you run it ?

npm start errors - React.js

I am trying to run a server so I can start coding my website. However, I run "npm start" I have been greeted with errors. The steps to fixing this error are laid out, however, for step three I do not see babel-loader within my package.json. In addition, I am not sure if the npm ERR!(s) I get on the bottom are caused because of the issue on top or another issue in itself.
package.json
"runs" npm ls babel-loader
It looks like you have globally installed babel-loader#8.0.2. See #6, it points to the exact case you have.
Remove it from your home directory and that should fix it.

Error: Cannot read property 'UIAppFonts' of null

When running react-native link it gives this error,
It says,
rnpm-install ERR! It seems something went wrong while linking. Error: Cannot read property 'UIAppFonts' of null
I had this exact same problem. I had accidentally deleted by Info.plist file in my ios directory. Restoring it, fixed my issue.
I had same issue not quite long, running react-native links will give you error.
If you are using yarn simply run:
yarn remove react-native
yarn add react-native
Then run react-native link
This fixed it for me.
I had this problem and in my case it was because I had renamed the project but forgotten to update newname in a few folders and files.
In case anyone runs across this, this is how I fixed the react-native linking issue w/ UIAppFonts:
# Regenerates ios files
react-native upgrade
# Works now
react-native link
Basically, it's pretty similar to the answer that Matt posts above, except I didn't know how to restore it.

Resources