简体   繁体   English

尝试创建反应应用程序时终端出错

[英]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 .解决此问题的首选方法是确保正确卸载nodenpm 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.

相关问题 运行create-react-app时终端错误 - Error in terminal when running create-react-app 尝试使用 npx create-react-app 时出现超时错误 - Timeout error when trying to use npx create-react-app 错误:尝试运行 create-react-app 时出现 memory - Error: out of memory when trying to run create-react-app 尝试创建反应应用程序时出现“找不到命令:create-react-app”错误 - "command not found: create-react-app" error when trying to create a react app 然后尝试 create-react-app 时出错(npm ERR!cb() never call!然后尝试 create-react-app) - Error then trying create-react-app( npm ERR! cb() never called! then trying create-react-app) create-react-app 在终端中没有响应时如何解决 - How to resolve when create-react-app not responding in terminal 尝试使用 npx create-react-app 安装 react 时出错 - Getting an error when trying to install react using npx create-react-app 尝试为create-react-app设置WebStorm IDE JavaScript调试器时出现404错误 - Getting a 404 error when trying to setup WebStorm IDE JavaScript debugger for a create-react-app 尝试安装 create-react-app 时出错 - Error While Trying to install create-react-app 尝试从部署的 create-react-app 中的公用文件夹中获取 json 文件时出现 404 错误 - 404 Error when trying to fetch json file from public folder in deployed create-react-app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM