[英]Error with terminal when trying to create-react-app
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:
我已经删除了节点、npm 和 npx 两次并再次下载,然后重新启动计算机 100 次但没有任何效果:
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:之后,如果我尝试 npm uninstall -g create-react-app 或其他任何东西,它总是会发送此错误:
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?我怎样才能解决这个问题?
First, remove the package.首先,移除 package。 If you have installed create-react package using npm then use
如果你已经使用 npm 安装了 create-react package 然后使用
- 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
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
.解决此问题的首选方法是确保正确卸载
node
和npm
。 Please follow the steps mentioned here .请按照此处提到的步骤操作。 Once properly uninstalled, head over to install node and proceed with the re-installation.
正确卸载后,前往安装节点并继续重新安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.