Home > Back-end >  Error with terminal when trying to create-react-app
Error with terminal when trying to create-react-app

Time:12-15

I'm trying to create a new react app, but I can't seem to do it. I have searched everywhere and done everything I could that can be done nothing is working. I have deleted node, npm, and npx two times and downloaded again, and then restarting my computer like 100 times but nothing works:

Need to install the following packages:
  create-react-app
Ok to proceed? (y) 

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

my@mycomp-MacBook-Pro ~ % npm uninstall -g create-react-app

up to date, audited 1 package in 176ms

found 0 vulnerabilities
my@mycomp-MacBook-Pro ~ % npx create-react-app my-app
Need to install the following packages:
  create-react-app
Ok to proceed? (y) 

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

my@mycomp-MacBook-Pro ~ % 

And after that if I try to npm uninstall -g create-react-app or anything else it alwayse send this error:

my@mycomp-MacBook-Pro ~ % npm uninstall npm uninstall -g create-react-app

npm ERR! code EACCES 

npm ERR! syscall rename

npm ERR! path /usr/local/lib/node_modules/npm

npm ERR! dest /usr/local/lib/node_modules/.npm-i9nnxROI

npm ERR! errno -13

npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'

npm ERR!  [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] {

npm ERR!   errno: -13,

npm ERR!   code: 'EACCES',

npm ERR!   syscall: 'rename',

npm ERR!   path: '/usr/local/lib/node_modules/npm',

npm ERR!   dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'

npm ERR! }

npm ERR! 

npm ERR! The operation was rejected by your operating system.

npm ERR! It is likely you do not have the permissions to access this file as the current user

npm ERR! 

npm ERR! If you believe this might be a permissions issue, please double-check the

npm ERR! permissions of the file and its containing directories, or try running

npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/mycomp/.npm/_logs/2021-12-15T12_37_53_679Z-debug.log
my@mycomp-MacBook-Pro ~ % 

How can I fix this?

CodePudding user response:

The problem seems to be that of an inappropriate installation. The go-to way to fix this would be to ensure a proper uninstall of node and npm. Please follow the steps mentioned here. Once properly uninstalled, head over to install node and proceed with the re-installation.

CodePudding user response:

First, remove the package. If you have installed create-react package using npm then use

- npm uninstall -g create-react-app

or if yarn

- yarn global remove create-react-app

Then you can create a project:

npx create-react-app my-app
  • Related