【问题标题】:npx create-react-app my-app not working. npm ERR! EEXISTnpx create-react-app my-app 不工作。 npm 错误!存在
【发布时间】:2021-09-15 00:05:17
【问题描述】:

我正在运行 npx create-react-app my-app 并收到以下错误:

Creating a new React app in D:\Other computers\My Laptop\Programming [P]\Web Development\Projects\my-portfolio\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path D:\Other computers\My Laptop\Programming [P]\Web Development\Projects\my-portfolio\my-app\node_modules\.staging
npm ERR! errno -4075
npm ERR! EEXIST: file already exists, mkdir 'D:\Other computers\My Laptop\Programming [P]\Web Development\Projects\my-portfolio\my-app\node_modules\.staging'
npm ERR! File exists: D:\Other computers\My Laptop\Programming [P]\Web Development\Projects\my-portfolio\my-app\node_modules\.staging
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

我试过了:

  • 卸载并安装 Node.js
  • 更新了 npm 和 npx
  • 全局安装 create-react-app,然后再次尝试创建应用
  • 试过 npm 缓存清理

请帮忙!

【问题讨论】:

  • 您是否按照建议尝试了npx create-react-app my-app --force?或者使用当前文件夹中尚未使用的名称运行它

标签: node.js reactjs npm node-modules npx


【解决方案1】:

如果您不想覆盖my-app 目录的内容,您可以随时为您的 react-app 选择不同的名称。这样的事情应该可以工作:

npx create-react-app myapp

但是,如果您不关心已经存在的目录,您可以这样做:

npx create-react-app my-app --force

【讨论】:

  • 我还没有一个名为 my-app 的目录,怎么覆盖呢?
  • 嗯,这很有趣。尝试通过运行sudo rm -rf my-app 删除,也许可以解决问题?
  • 我有一个疑问。我试图在其中制作我的 react 应用程序的文件夹在我的硬盘 / ssd 上不存在。它在我的云存储 Gdrive 上。我使用谷歌的备份和同步应用程序访问它。跟这个有关系吗?
猜你喜欢
  • 2020-08-11
  • 1970-01-01
  • 1970-01-01
  • 2022-01-07
  • 2021-06-17
  • 2021-09-07
  • 1970-01-01
  • 2022-06-14
  • 1970-01-01
相关资源
最近更新 更多