I want to create a test React apllication but I am stuck at the installation:
I install Yarn with npm because the yarn msi doesn't start, so:
1. npm i .g yarnpkg
2. yarn create react-app test
and I read this error message:
yarn create v0.15.1 error Couldn't find a package.json (or bower.json)
file in C:\Users***\React
at C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\lib\config.js:355:13
at Generator.next ()
at step (C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
at C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13
info Visit http://yarnpkg.com/en/docs/cli/create for documentation
about this command.
I tried to search it on Internet but they did not solve my problem. Please, help me.
To anyone visiting this thread in 2021, it's very likely you're running
yarn create-react-app my-app instead of yarn create react-app my-app.
You should initiate a npm project first.
cd projectfolder
npm init
yarn create react-app my-app
Related
This is what I'm getting
I am not able to create a project using create-react-app, I get the error "Module not found".
Node version is 17.0.1 and Npm version is 8.1.1
I have reinstalled nodejs 3 times now and have tried different commands like
npm install create-react-app -g
npm cache clean --force
P.S - I have updated the nodejs to 17.0.1 as the picture version shows 16.13.0
You can try with npx create-react-app my-app.
Visit for more details create-react-app
To create a new app, you may choose one of the following methods:
npx
npx create-react-app my-app
npm
npm init react-app my-app
npm init <initializer> is available in npm 6+
Yarn
yarn create react-app my-app
yarn create is available in Yarn 0.25+
So after almost 3-4 hours of trying different things, it has worked.
I dont know which particular thing would have helped it to work but following are the things I tried -
Delete npm and npm cache folder.
Reinstall the nodejs (LTS version).
Create the app in another folder.
Used power shell instead of CMD.
npm fix
npm fix --force
npx create-react-app my-app
cd my-app
npm start
This is how I created a react app. But if I get an already ready app in react how will I run it?
Inside the project directory run: npm install, this will install all of your project dependencies, and after that, you can start the app with the npm start command.
Open the Terminal,
Go to Project Directory
Use this command
npm install
It will install all the dependencies that are necessary to run this project.
Now run the development server
npm start
Development:
npm install
npm start
Production*:
./build/index.html
*if build folder doesn't exist then execute:
npm run build
I kind of rushed into creating a React app based on a tutorial that used yarn. Now I'm going to re-create the app from scratch because I'm not satisfied with the reactstrap library, and I'd like to switch to react-bootstrap.
I've re-installed node. However, when I run create-react-app, it says to use "yarn" instead of "npm" as follows:
yarn start
Starts the development server.
yarn build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd react-test
yarn start
I'd like to use npm because it seems like it's more widely used and there are more examples based on it. Am I stuck with yarn, or can I go ahead and use npm?
You can either
1) Remove yarn.lock, and running npm i,
or
2) Run create-react-app app --use-npm
1 ⇢ If you have installed create-react-app then use:
create-react-app --use-npm
2 ⇢ If you are using npx command then use:
npx create-react-app --use-npm
3 ⇢ For existing yarn app, remove the yarn.lock file and run:
npm i
or
npm install
Install create-react-app npm i -g create-react-app --use-npm
Go to desired path using cd command
Add --use-npm create-react-app my-app-name --use-npm
This command will create a folder with the name that you mentioned inside your current path . This folder consists all necessary configuration files needed for a starter code for react application
# Run this to create-react-app using npm
npx create-react-app my-app
# Or run this to create-react-app using yarn
yarn create react-app my-app
I dont know if this helps. But I was having the same problem and did this
npx expo-cli init --npm
and it installed with npm
hope this helps you or someone in the future
For latest versions, the flag is changed to --npm
So if you want to use npm then use it like
npx react-native init YourProject --npm
While creating a new react app, getting this error.
Aborting installation. yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\.... \my-app has failed.
I know #5328 gave solution by removing . npmrc file here - https://github.com/facebook/create-react-app/issues/5328#issuecomment-429148117
I am new to react .. so can some one please let me know how do I find .npmrc file and how do i remove it? Or how do I create a new react app without having this error?
I know we can create a react app with the following command:
npx create-react-app my-app
or
yarn create react-app my-app
or
npm init react-app my-app
Thanks!
Okay,
I solved this problem by following the below steps:
npm install -g npm#latest
npm install node
npm install -g yarn
yarn cache clean
npx create-react-app my-app
I faced the same issue while creating a new app with CRA.
I tried all the below-mentioned solution:
1) Uninstall Yarn and install again.
2) yarn cache clean
3) npm uninstall -g create-react-app and install again.
Here's main issue:
error #typescript-eslint/eslint-plugin#2.13.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.11.0"
error Found incompatible module.
You may have got something similar. Look a couple of lines above "Aborting installation"
In my case, I was using Node version "10.11.0". I install a stable version of Node and it worked absolutely fine.
To double-check I tried to simulate the issue by changing the version with the help of NVM, and got the same issue.
Please refer to the error message and you'll figure out the culprit.
Note: I would still suggest keeping the updated and stable version of Yarn and CRA.
I came across the following problem
I ref react-app tutorials to create a react-app demo. When I run create-react-app my-app command, it failed.
After that, I have changed npm mirror to taobao.org(in China). But it also failed.
npm config set registry https://registry.npm.taobao.org
So, how to slove the problem.
I uninstall yarn and reinstall .
Reinstall node
Reinstall react-app.
Need administrator's permission to install react-app in CMD.
With the method, I install react-app successfully!