我正在运行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时,它也会抛出上面的WARNs,但它也会显示
+ 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发布于 2022-01-13 19:17:38
在全局卸载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
发布于 2020-01-24 20:52:58
要完全卸载它,请尝试运行
sudo npm uninstall -g create-react-app有时,此命令可能不会完全删除软件包。如果是,只需检查它所在的目录
which 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>发布于 2020-01-20 04:04:53
windows的
我试过npm uninstall -g create-react-app,但对我不起作用。
我做了以下工作,它起作用了:
where create-react-app它位于系统文件中yarn下的某个位置。按照该路径删除这两个文件。npx create-react-app my-test-app这将创建一个名为my-test-app的新文件夹,您可以按照react应用程序网站上的其余说明进行操作。
cd进入该新文件夹,运行yarn start
https://stackoverflow.com/questions/59451813
复制相似问题