npx create-react-app 在 big sur 上执行 yarnpkg 时失败

Gre*_*egg 8 reactjs create-react-app npx macos-big-sur

我已经找到了一些关于此的帖子,但现有的解决方案似乎都不起作用。

  • OSX 大苏尔
  • 纱线 1.22.10
  • npm 7.0.11
  • 我更新了 xcode 开发人员工具。
  • 我删除了 npm 缓存
  • 我删除了 .npm 和 .yarnrc 文件夹

然后尝试使用以下内容启动一个新的 React 应用程序npx create-react-app

error An unexpected error occurred: "expected workspace package to exist for \"eslint\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/gdboling/Projects/BalancedComp/clients/packages/rewards/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd /Users/gdboling/Projects/BalancedComp/clients/packages/rewards has failed.
Run Code Online (Sandbox Code Playgroud)

日志文件有:

26 verbose stack Error: command failed
26 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
26 verbose stack     at ChildProcess.emit (node:events:329:20)
26 verbose stack     at maybeClose (node:internal/child_process:1055:16)
26 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
Run Code Online (Sandbox Code Playgroud)

小智 0

Vue 项目也有完全相同的问题。我正在使用 OSX Catalina 和 npm 7.0.8。

我的错误已通过此处找到的帖子解决:https://forum.quasar-framework.org/topic/6258/errors-updating-to-v2/5

FrankM的回答:


检查你的index.template.html。将htmlWebpackPlugin.options.ctx.mode
替换为ctx.mode


也许这会有所帮助,并且您的项目中的任何位置都有类似的条目。