卸载create-react-app的问题 [英] Issues with uninstalling create-react-app

查看:842
本文介绍了卸载create-react-app的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 npm卸载create-react-app ,它返回

  npm WARN saveError ENOENT:没有这样的文件或目录,请打开'/Users/me/Documents/package.json'
npm WARN enoent ENOENT:没有这样的文件或目录,请打开'/ Users / me / Documents / package.json'
npm WARN文档没有描述
npm WARN文档没有存储库字段。
npm WARN文档没有自述文件
npm WARN文档没有许可证字段。

我想更新我的create-react-app版本,显然他们不再支持全局安装。第一次(前一段时间)安装CRA时,它是全局安装的。现在,我正在尝试对其进行更新,但是遇到了问题。我运行了 npm update create-react-app ,但是我的终端只闪烁了一秒钟,然后返回到提示。因此,我决定完全卸载 create-react-app 并重新安装它,但是现在我遇到了以上警告/问题。



有什么想法吗?



编辑:



何时我运行 npm我create-react-app ,它还会抛出上面的 WARN s,但它也会显示

  + create-react-app@3.3.0 //< --- 
添加了1个软件包并审核了578个软件包在1.787s中

但是,当我运行命令 create-react-app --version 再次显示为 3.2.0



编辑2: p>

我已经运行了 npm i -g create-react-app 了几次,但这会抛出:

  Michaels-MacBook-Pro:记录我$ npm i -g create-react-app 
npm ERR!代码EEXIST
npm错误! syscall symlink
npm错误!路径../lib/node_modules/create-react-app/index.js
npm错误! dest / usr / local / bin / create-react-app
npm错误! errno -17
npm错误! EEXIST:文件已存在,符号链接‘../lib/node_modules/create-react-app/index.js’-> ‘/ usr / local / bin / create-react-app’
npm ERR!文件存在:/ usr / local / bin / create-react-app
npm错误!删除现有文件,然后重试,或运行npm
npm ERR!使用--force可以不计后果地覆盖文件。

npm错误!可以在以下位置找到该运行的完整日志:
npm ERR! /Users/me/.npm/_logs/2019-12-23T08_07_29_158Z-debug.log


解决方案

要完全卸载它,请尝试运行

  sudo npm uninstall -g create-react -app 

有时此命令可能无法完全删除软件包。如果是这样,只需检查目录
所在的位置

 哪个create-react-app 

,它将为您提供一些目录,例如/ usr / local / bin / create-react-app。
只需通过以下方式手动将其删除:

  rm -rf / usr / local / bin / create-react-app 

现在您可以通过以下方式安装create-react-app了:

  npm install -g create-react-app 

但是但是,不建议从v3.3.0全局安装它,因此只需使用

  npx create-react-app< project_name> 


I am running npm uninstall create-react-app, and it returns

npm WARN saveError ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/me/Documents/package.json'
npm WARN Documents No description
npm WARN Documents No repository field.
npm WARN Documents No README data
npm WARN Documents No license field.

I want to update my create-react-app version, and apparently they no longer support global installs. When I installed CRA the first time (a while ago), it was installed globally. Now, I am trying to update it, and I'm running into issues. I ran npm update create-react-app, however my terminal just blinks for a second and returns to the prompt. I, therefore, decided to uninstall create-react-app altogether and reinstall it, however now I'm running into the above warnings/issues.

Any thoughts on what may be going on?

Edit:

When I run npm i create-react-app, it also throws the above WARNs, but it also says

+ create-react-app@3.3.0 // <---
added 1 package and audited 578 packages in 1.787s

However, when I run the command create-react-app --version again, it says 3.2.0

Edit 2:

I've ran npm i -g create-react-app several times, but that throws:

Michaels-MacBook-Pro:Documents me$ npm i -g create-react-app
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/create-react-app/index.js
npm ERR! dest /usr/local/bin/create-react-app
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/create-react-app/index.js' -> '/usr/local/bin/create-react-app'
npm ERR! File exists: /usr/local/bin/create-react-app
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2019-12-23T08_07_29_158Z-debug.log

解决方案

To uninstall it completely try running

sudo npm uninstall -g create-react-app

some times this command may not remove the package completely. if so just check the directory where its located by

which create-react-app

and it will give you some directory like /usr/local/bin/create-react-app. just remove it manually by

rm -rf /usr/local/bin/create-react-app

now you can install create-react-app by

npm install -g create-react-app

but however, it is not recommended to install it globally from v3.3.0.so just use

npx create-react-app <project_name>

这篇关于卸载create-react-app的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆