1

After installing nodejs, while creating a new react application I am facing the following issue.

I've tried reinstalling nodejs and maybe that is not the solution.

C:\Users\abhis>npm i create-react-app
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\abhis\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\abhis\package.json'
npm WARN abhis No description
npm WARN abhis No repository field.
npm WARN abhis No README data
npm WARN abhis No license field.

+ [email protected]
added 53 package from 35 contributors, updated 1 package and audited 166 packages in 18.807s

6 packages are looking for funding
 run `npm fund` for details

found 0 vulnerabilities

3 Answers 3

1

The problem is that there is no package.json file, therefore you can't install (npm i) packages.

To create a package.json file try npm init.

However, if you want to create new react app using create-react-app, just execute: npx create-react-app my-app.

Sign up to request clarification or add additional context in comments.

6 Comments

After execution of npx create-react-app my-app. instead of creation of an application i am facing this issue [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\babel-runtime\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js-pure > node -e "try{require('./postinstall')}catch(e){}"
I found something that might help: github.com/facebook/create-react-app/issues/8441
This one looks same. but i am unable to solve it from the link. can you please help me in detail.
Can you give more information? Plus, did you executed it in an empty directory?
yes, i executed in an empty directory. what all info you need?
|
0

you have installed package successfully,

to create app, here is the 2 approach you can use

after installing create react app,

npm init react-app my-app

another approach is,

npx create-react-app my-app

also, have a look at official documentation. https://create-react-app.dev/docs/getting-started/

4 Comments

After execution of npx create-react-app my-app. instead of creation of an application i am facing this issue [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\babel-runtime\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js-pure > node -e "try{require('./postinstall')}catch(e){}"
which npm version you have ?
i tried the first approach, no i got an error similar to this one github.com/facebook/create-react-app/issues/8441 which was suggested by @SomoKRoces. can you please help me in detail? i am unable to do that. my npm version is: 6.14.6.
have you tried this solution ? npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
0

To create a react app using create-react-app you have 2 options:

  • install globally create-react-app using this command: npm install --global create-react-app and then create your react project with: create-react-app project_name
  • the other option which is the recommanded one is by directly creating you app using this command: npx create-react-app project_name. source: https://create-react-app.dev/docs/getting-started/

using npm i create-react-app didn't work for you because you don't have a package.json like @SomoKRoceS mentioned.

7 Comments

After execution of npx create-react-app my-app. instead of creation of an application i am facing this issue [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\babel-runtime\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js > node -e "try{require('./postinstall')}catch(e){}" > [email protected] postinstall C:\Users\abhis\Desktop\web\my-app\node_modules\core-js-pure > node -e "try{require('./postinstall')}catch(e){}"
@abhishek gattineni which npm version do you have ?
the version i am using is 6.14.6
try this, maybe it will help you dev.to/gouthamigou/comment/n2do
this problem is same as mine. There they used npm cache clear --force, even after executing this command nothing positive turned out.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.