Running into this error below when using npx create-react-app
Husna#LAPTOP-LPCC954R MINGW64 ~/Desktop/React GitHib Project (master)
$ npx create-react-app github2020
Creating a new React app in C:\Users\Husna\Desktop\React GitHib Project\github2020.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
core-js#2.6.11 postinstall C:\Users\Husna\Desktop\React GitHib Project\github2020\node_modules\babel-runtime\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"
core-js#3.6.5 postinstall C:\Users\Husna\Desktop\React GitHib Project\github2020\node_modules\core-js
node -e "try{require('./postinstall')}catch(e){}"
core-js-pure#3.6.5 postinstall C:\Users\Husna\Desktop\React GitHib Project\github2020\node_modules\core-js-pure
node -e "try{require('./postinstall')}catch(e){}"
+ react-dom#16.13.1
+ react-scripts#3.4.1
+ react#16.13.1
added 1601 packages from 751 contributors and audited 1605 packages in 869.821s
59 packages are looking for funding
run `npm fund` for details
found 4981 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
In my case, npx sometimes create issues for me to if you have already install yarn then try to create your react app through it.
In case you don't have yarn already.
you can install yarn through npm i -g yarn
and then you can just create your react app directly without using npx
create-react-app github2020
Related
I have problem using npx create-react-app but i have the pproblem below. I have tried using npm cache clean --force and then npx but the problem persist... Any suggestions?? i have tried using different nodes versions
npx: installed 67 in 4.058s
Creating a new React app in /Users/nestorvargas/Documents/React/myfirstreactapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nestorvargas/.npm/_logs/2022-06-26T02_40_25_044Z-debug.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting myfirstreactapp/ from /Users/nestorvargas/Documents/React
Done.
I have installed nodejs then I tried to create react is app using npx create-react-app my-app but it just stuck in installing react-dom,cra-templates and then I tried npm also but it's the same please help need to learn react js please help
I have node version v16.13.2.
and npm version 8.1.2
PS D:\Programming\React Js> npx create-react-app firstapp
Creating a new React app in D:\Programming\React Js\firstapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
You can try to install globally, generally there are no more problems after. To install run this command
npm install -g create-react-app
Once installation successful, try running
npx create-react-app my-app
You likely have a global installation of create-react-app which is not the latest version. Uninstall it using npm uninstall -g create-react-app.
The CRA docs recommend uninstalling the global version in their very first steps:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
enter code here I've created a react project, using command : npm create-react-app
Installed
node-sass: "^5.0.0"
react: "^17.0.1"
Then I tried to import blank index.scss file to index.js componenet
Screenshot Code of Index.js
[Code of Index.js][1]
Screenshot of Localhost
image of localhost having the description of error
Special Note :
After getting this I Have uninstall node-sass and installed again with version4+. Please find below screenshot of cmd.
npm uninstall node-sass
npm install node-sass#4.14.1
cmd screenshot
Please uninstall it an then install the last version of 4:
npm uninstall node-sass
npm install node-sass#4.x
npm uninstall node-sass
npm install node-sass#4.14.1
Or, if using yarn (default in newer CRA versions)
yarn remove node-sass
yarn add node-sass#4.14.1
Do not go back. That’s quitting.
rm -rf ./node_modules ./package-lock.json
Then
npm i
Done ✅
Try installing sass instead of node-sass.
yarn remove node-sass
yarn add sass
when I run the following command to create a react app:
C:\WINDOWS\system32> npm i create-react-app -g hello
I get the following message in cmd:
npm WARN deprecated hello-config#1.0.1: Use #hello/config instead
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
C:\Users\Simran Shivani\AppData\Roaming\npm\create-react-app -> C:\Users\Simran Shivani\AppData\Roaming\npm\node_modules\create-react-app\index.js
C:\Users\Simran Shivani\AppData\Roaming\npm\hello -> C:\Users\Simran Shivani\AppData\Roaming\npm\node_modules\hello\cli\index.js
> core-js#2.6.11 postinstall C:\Users\Simran Shivani\AppData\Roaming\npm\node_modules\hello\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> ejs#2.7.4 postinstall C:\Users\Simran Shivani\AppData\Roaming\npm\node_modules\hello\node_modules\ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
npm WARN glob-promise#3.4.0 requires a peer of glob#* but none is installed. You must install peer dependencies yourself.
+ create-react-app#3.4.1
+ hello#0.3.2
added 379 packages from 242 contributors in 152.381s
What am I doing wrong?
Your command tries to install the packages create-react-app and hello globally, If you are using npm 5.2 or later there is no reason to install create-react-app globally.
Use the recommended command to create your app instead,
npx create-react-app my-app
This command will get the latest version of create-react-app and generate your project inside a folder name my-app in your current working directory without installing create-react-app globally.
Then you can change the working directory to my-app and start the development server by running the command npm start.
You can refer to the docs for more details.
Even though everything used to work couple of weeks ago, now I can not successfully create new react app with its templates.
When I try to run npx create-react-app my-app command, it only creates the folder with package.json, pckage-lock.json and node_modules. The public folder is missing and also, when I try to run npm start, it gives me an error saying:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
before it used to say happy hacking and the template page with react logo was displayed.
I tried to uninstall and install node again, clear cache but nothing helped. Any advice? Thank you so much!
My npm -v is 6.13.4 and node -v is v12.14.0
If you have installed create-react-app globally. remove that globally from you system
Try these steps
npm uninstall -g create-react-app
npx create-react-app app_name
cd app_name
npm start
Note- npx comes with npm 5.2+ and higher, see instructions for older
npm versions
Check this reactjs documentation.
Faced the same issue and fixed it by following the below steps:
Try to uninstall all existing global installation of create-react-app and check that they are removed properly by using the two commands below:
command for uninstalling: npm uninstall -g create-react-app
command for checking: which create-react-app
command for manual delete: rm -rf <path where create react app is located>
Once all the versions are removed, use: npx create-react-app <name_of_the_app>
For more details refer here
First, update the npm and node using following commands:
npm install -g npm
npm cache clean -f
npm install -g n
n stable
Remove globally installed create-react-app using:
npm uninstall -g create-react-app
Use npx for using create-react-app directly:
npx create-react-app <project-name>
I was having the same issue, and saw a lot of the same answers saying to uninstall create-react-app globally and reinstall using npx create-react-app my-app.
Downgrading my version of Node to 8.11.1 is what fixed it.
sudo npm install -g n
sudo n 8.11.1
node -v
> v8.11.1
After that I ran npx create-react-app my-app and it worked as expected.