microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.54k stars 135 forks source link

Command failed: yarn add -s "react-native-macos@^0.71.0-0" #1856

Closed jmatsushita closed 2 months ago

jmatsushita commented 1 year ago

Environment

react-native -v: 10.2.4
npm ls react-native-macos: react-native-macos@0.71.13
node -v: v16.20.0
npm -v: 8.19.4
yarn --version: 1.22.19 / 3.6.0 (berry)
xcodebuild -version: Xcode 14.3 Build version 14E222b

Steps to reproduce the bug

in a fresh project:

npx react-native init repro-yarn-berry --template react-native@^0.71.0
cd repro-yarn-berry
# ensure you're using berry
yarn set version berry

Run

npx react-native-macos-init

Expected Behavior

Install without error.

Actual Behavior

Fails with

Reading application name from package.json…
Reading react-native version from node_modules…
Reading react-native-macos version from node_modules…
Latest matching version of react-native-macos for react-native@0.71.11 is react-native-macos@0.71.13.
Installing react-native-macos@^0.71.0-0…
Command failed: yarn add -s "react-native-macos@^0.71.0-0" Error: Command failed: yarn add -s "react-native-macos@^0.71.0-0"
    at checkExecSyncError (node:child_process:861:11)
    at Object.execSync (node:child_process:932:15)
    at Object.<anonymous> (~/.npm/_npx/20f1505fae2cef5b/node_modules/react-native-macos-init/lib-commonjs/cli.js:247:29)
    at Generator.next (<anonymous>)
    at fulfilled (~/.npm/_npx/20f1505fae2cef5b/node_modules/react-native-macos-init/lib-commonjs/cli.js:10:58)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processImmediate (node:internal/timers:437:9) {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer 1b 5b 33 31 6d 1b 5b 31 6d 55 6e 6b 6e 6f 77 6e 20 53 79 6e 74 61 78 20 45 72 72 6f 72 1b 5b 32 32 6d 1b 5b 33 39 6d 3a 20 55 6e 73 75 70 70 6f 72 74 ... 183 more bytes>,
    <Buffer >
  ],
  pid: 21420,
  stdout: <Buffer 1b 5b 33 31 6d 1b 5b 31 6d 55 6e 6b 6e 6f 77 6e 20 53 79 6e 74 61 78 20 45 72 72 6f 72 1b 5b 32 32 6d 1b 5b 33 39 6d 3a 20 55 6e 73 75 70 70 6f 72 74 ... 183 more bytes>,
  stderr: <Buffer >
}

Reproducible Demo

No response

Additional context

Switching back to classic just works:

yarn set version classic
npx react-native-macos-init

Completes without errors.

Saadnajmi commented 1 year ago

Seems like something is failing in react-native-macos-init? Perhaps that module needs to be updated to support more modern package managers?

pac-guerreiro commented 1 year ago

I just faced this issue and solved it by enabling corepack -> https://yarnpkg.com/getting-started/install

zeevl commented 1 year ago

the actual error is Unknown Syntax Error: Unsupported option name ("-s").

CommanderRedYT commented 4 months ago

Was there a fix to this?

Saadnajmi commented 4 months ago

Sorry, issue still open. Fix is known and committed, but the new version of react-native-macos-init isn't published that contains the fix because of a publishing issue.

Saadnajmi commented 2 months ago

Fixed with version 2.1.2