reactjs - 卸载 create-react-app 的问题
问题描述
我在跑npm uninstall create-react-app
,它回来了
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.
我想更新我的 create-react-app 版本,显然它们不再支持全局安装。当我第一次(不久前)安装 CRA 时,它是全局安装的。现在,我正在尝试更新它,但遇到了问题。我跑了npm update create-react-app
,但是我的终端只是闪烁了一秒钟并返回到提示符。因此,我决定create-react-app
完全卸载并重新安装它,但是现在我遇到了上述警告/问题。
对可能发生的事情有任何想法吗?
编辑:
当我运行时npm i create-react-app
,它也会抛出上面WARN
的s,但它也说
+ create-react-app@3.3.0 // <---
added 1 package and audited 578 packages in 1.787s
但是,当我再次运行命令create-react-app --version
时,它说3.2.0
编辑2:
我跑npm i -g create-react-app
了好几次,但这会抛出:
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
解决方案
在全局卸载 create-react-app 后,我仍然收到我的 create-react-app 已过期的错误。这是为我解决的问题:
后
sudo npm uninstall -g create-react-app
跑
npx clear-npx-cache
然后尝试在正确的工作目录中重新安装 create-react-app:
npx create-react-app my-app
推荐阅读
- powershell - Powershell send-mailmessage 从 csv 读取 17k 电子邮件并在每封电子邮件中发送给 100 个用户
- c - C WIN32是否关闭std句柄
- mysql - 查找所选列的每一行的最小值
- vba - 使用 VBA (Excel) 模仿 Java 8
- ruby-on-rails - 将 Bootstrap 4 与 Rails 6 Webpacker 一起使用时出错
- c# - 如何从 c# 中的 webbrowser 中获取 html value 属性的值?
- c# - MVVM 在视图之间切换
- sql - 在sql中使用union all时如何在最后显示空值
- java - 具有最大值的参数的java构造函数
- python - 通过脚本从 GitLab 克隆一组 repos