Why is the create-react-app command not working? - reactjs

Wanted to create a new react app, and ran both npx create-react-app and init react-app command in my Mac terminal but it's not working.
Tried a couple of times, but sometimes the folder is created with a package.json file only. Then everything stopped downloading. What could be the issue?
Screenshot of the output in the terminal:

According to your screenshot, there is no problem when you initialize your react project.
I think your local network may not be good enough. To create a react app, you need to install many third-party nodes_modules then cause mistakes.
Therefore, you can try to change the npm source, such as taobao( https://registry.npm.taobao.org )
npm config set registry xxx
And then use the craete-react-app to initialize the app.

Related

Facing issue when tried running yarn create react-app client

So when I try to create a react app using yarn I am facing this error. I don't understand why I am receiving this, this is my first time using yarn. It would be great if you could guide me through I want to create a react app with yarn. I face no issues when running npx command.
From the screenshot, it can be seen that it is due to the space in your Windows user name - Adil Asif. Command prompt takes whatever before Adil in the path as command and rest from Asif as arguments, instead of yarn as command and create-react-app client as argument.
You could try using NPM or check the corresponding github issue. You can also create project in another drive if available or in the root folder of C: drive.
Github issue and fix

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.

Receiving error when creating new app using create react app

For some reason when trying to create a new app using create react app, it results in errors everytime. Anybody know what's going on?
Error Stack
Have you tried it without the additional --use-npm flags at the end?
npx create-react-app user-onboarding
cd user-onboarding
npm start
Official docs
Edit: Yeah, reading your errors in the screenshot it appears that the --use-npm flag is causing it to use npm which has outdated versions available, but npx always finds the newest versions. Which is a big reason it is the preferred method for installing create-react-app
If you have your heart set on using npm you can always do an npm update before running it again.

How to run an existing REACT project

Beginner here, please help.
(1)If I have the files of a react project which was built on codesandbox or by another dev, how do I run the app and make changes in VSCode on my own machine.
(2)How do I run an existing personal create-react-app project on my machine, so as to continue buliding?
Open a terminal on vscode, then make sure you already node installed.
Type npm install after that npm run start or whatever command to run, you can see on package.json.
The first thing you need is to install updated version of nodejs, you can type to google “download nodejs” and make sure you download the stable version.
You need to open a terminal, also make sure you can locate your file path then type:
cd your file path: your-appName (this should be the name of your app)

SCSS compilation issue in #material/button/_mixins.scss

issue-screen-shot
I'm getting this issue it's quite troublesome can anyone please help me out reagarding this issue...
I'm getting this issue when trying to build my react project.
build script screen-shot
node-sass already addedd
To get MDC React Components to work with create-react-app you need to set a SASS_PATH environment variable that points to your node_modules directory. To quickly do this on OS X or Linux enter the following in your command line:
export SASS_PATH=./node_modules
If you're on Windows use the following:
SET SASS_PATH=.\node_modules
Rename your src/App.css file to src/App.scss.
You will also need to install node-sass:
npm install node-sass

Resources