Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postinstall script "install-native.mjs" does not work with Yarn 3 #52970

Closed
1 task done
syedtaqi95 opened this issue Jul 20, 2023 · 1 comment · Fixed by #52971
Closed
1 task done

Postinstall script "install-native.mjs" does not work with Yarn 3 #52970

syedtaqi95 opened this issue Jul 20, 2023 · 1 comment · Fixed by #52971
Labels
bug Issue was opened via the bug report template. locked SWC Related to minification/transpilation in Next.js.

Comments

@syedtaqi95
Copy link
Contributor

syedtaqi95 commented Jul 20, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 18.17.0
      npm: 9.6.7
      Yarn: N/A
      pnpm: 7.24.3
    Relevant Packages:
      next: 13.4.10
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

Package manager (npm, pnpm, Yarn), SWC transpilation

Link to the code that reproduces this issue or a replay of the bug

https://github.com/vercel/next.js

To Reproduce

  • Set Yarn version to 3+ yarn set version latest
  • Open the vercel/next.js respository
  • Run pnpm install, or if dependencies are already installed, run pnpm postinstall

Describe the Bug

Script exits with the following error:

Error: Command failed with exit code 1 (EPERM): yarn --force
    at makeError (/home/syed/repos/next.js/node_modules/.pnpm/[email protected]/node_modules/execa/lib/error.js:58:11)
    at handlePromise (/home/syed/repos/next.js/node_modules/.pnpm/[email protected]/node_modules/execa/index.js:112:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///home/syed/repos/next.js/scripts/install-native.mjs:59:22 {
  command: 'yarn --force',
  exitCode: 1,
  exitCodeName: 'EPERM',
  stdout: '\x1B[31m\x1B[1mUnknown Syntax Error\x1B[22m\x1B[39m: Unsupported option name ("--force").\n' +
    '\n' +
    '$ yarn cache clean [--mirror] [--all]\n' +
    '$ yarn cache clean [--mirror] [--all]\n' +
    '$ yarn config get [--json] [--no-redacted] <name>\n' +
    '$ yarn config set [--json] [-H,--home] <name> <value>\n' +
    '$ yarn config unset [-H,--home] <name>\n' +
    '$ yarn set resolution [-s,--save] <descriptor> <resolution>\n' +
    '$ yarn set version [--only-if-needed] <version>\n' +
    '$ yarn workspaces list [--since] [-R,--recursive] [--no-private] [-v,--verbose] [--json]\n' +
    '$ yarn --clipanion=definitions\n' +
    '$ yarn help\n' +
    '$ yarn help\n' +
    '$ yarn help\n' +
    '$ yarn <leadingArgument> ...\n' +
    '$ yarn -v\n' +
    '$ yarn -v\n' +
    '$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...\n' +
    '$ yarn bin [-v,--verbose] [--json] [name]\n' +
    '$ yarn config [-v,--verbose] [--why] [--json]\n' +
    '$ yarn dedupe [-s,--strategy #0] [-c,--check] [--json] [--mode #0] ...\n' +
    '$ yarn exec <commandName> ...\n' +
    '$ yarn explain peer-requirements [hash]\n' +
    '$ yarn explain [--json] [code]\n' +
    '$ yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...\n' +
    '$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]\n' +
    '$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]\n' +
    '$ yarn link [-A,--all] [-p,--private] [-r,--relative] <destination>\n' +
    '$ yarn unlink [-A,--all] ...\n' +
    '$ yarn node ...\n' +
    '$ yarn plugin import <name>\n' +
    '$ yarn plugin remove <name>\n' +
    '$ yarn plugin list [--json]\n' +
    '$ yarn plugin runtime [--json]\n' +
    '$ yarn rebuild ...\n' +
    '$ yarn remove [-A,--all] [--mode #0] ...\n' +
    '$ yarn run\n' +
    '$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...\n' +
    '$ yarn up [-i,--interactive] [-E,--exact] [-T,--tilde] [-C,--caret] [-R,--recursive] [--mode #0] ...\n' +
    '$ yarn why [-R,--recursive] [--json] [--peers] <package>\n' +
    '$ yarn workspace <workspaceName> <commandName> ...\n' +
    '$ yarn create [-p,--package #0] [-q,--quiet] <command> ...\n' +
    '$ yarn dlx [-p,--package #0] [-q,--quiet] <command> ...\n' +
    '$ yarn init [-p,--private] [-w,--workspace] [-i,--install]\n' +
    '$ yarn npm audit [-A,--all] [-R,--recursive] [--environment #0] [--json] [--severity #0] [--exclude #0] [--ignore #0]\n' +
    '$ yarn npm info [-f,--fields #0] [--json] ...\n' +
    '$ yarn npm login [-s,--scope #0] [--publish] [--always-auth]\n' +
    '$ yarn npm logout [-s,--scope #0] [--publish] [-A,--all]\n' +
    '$ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish] [--otp #0]\n' +
    '$ yarn npm tag add <package> <tag>\n' +
    '$ yarn npm tag list [--json] [package]\n' +
    '$ yarn npm tag remove <package> <tag>\n' +
    '$ yarn npm whoami [-s,--scope #0] [--publish]\n' +
    '$ yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]\n' +
    '$ yarn patch-commit [-s,--save] <patchFolder>\n' +
    '$ yarn patch [--json] <package>\n' +
    '$ yarn unplug [-A,--all] [-R,--recursive] [--json] ...',
  stderr: '',
  all: '\x1B[31m\x1B[1mUnknown Syntax Error\x1B[22m\x1B[39m: Unsupported option name ("--force").\n' +
    '\n' +
    '$ yarn cache clean [--mirror] [--all]\n' +
    '$ yarn cache clean [--mirror] [--all]\n' +
    '$ yarn config get [--json] [--no-redacted] <name>\n' +
    '$ yarn config set [--json] [-H,--home] <name> <value>\n' +
    '$ yarn config unset [-H,--home] <name>\n' +
    '$ yarn set resolution [-s,--save] <descriptor> <resolution>\n' +
    '$ yarn set version [--only-if-needed] <version>\n' +
    '$ yarn workspaces list [--since] [-R,--recursive] [--no-private] [-v,--verbose] [--json]\n' +
    '$ yarn --clipanion=definitions\n' +
    '$ yarn help\n' +
    '$ yarn help\n' +
    '$ yarn help\n' +
    '$ yarn <leadingArgument> ...\n' +
    '$ yarn -v\n' +
    '$ yarn -v\n' +
    '$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--mode #0] ...\n' +
    '$ yarn bin [-v,--verbose] [--json] [name]\n' +
    '$ yarn config [-v,--verbose] [--why] [--json]\n' +
    '$ yarn dedupe [-s,--strategy #0] [-c,--check] [--json] [--mode #0] ...\n' +
    '$ yarn exec <commandName> ...\n' +
    '$ yarn explain peer-requirements [hash]\n' +
    '$ yarn explain [--json] [code]\n' +
    '$ yarn info [-A,--all] [-R,--recursive] [-X,--extra #0] [--cache] [--dependents] [--manifest] [--name-only] [--virtuals] [--json] ...\n' +
    '$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]\n' +
    '$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]\n' +
    '$ yarn link [-A,--all] [-p,--private] [-r,--relative] <destination>\n' +
    '$ yarn unlink [-A,--all] ...\n' +
    '$ yarn node ...\n' +
    '$ yarn plugin import <name>\n' +
    '$ yarn plugin remove <name>\n' +
    '$ yarn plugin list [--json]\n' +
    '$ yarn plugin runtime [--json]\n' +
    '$ yarn rebuild ...\n' +
    '$ yarn remove [-A,--all] [--mode #0] ...\n' +
    '$ yarn run\n' +
    '$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...\n' +
    '$ yarn up [-i,--interactive] [-E,--exact] [-T,--tilde] [-C,--caret] [-R,--recursive] [--mode #0] ...\n' +
    '$ yarn why [-R,--recursive] [--json] [--peers] <package>\n' +
    '$ yarn workspace <workspaceName> <commandName> ...\n' +
    '$ yarn create [-p,--package #0] [-q,--quiet] <command> ...\n' +
    '$ yarn dlx [-p,--package #0] [-q,--quiet] <command> ...\n' +
    '$ yarn init [-p,--private] [-w,--workspace] [-i,--install]\n' +
    '$ yarn npm audit [-A,--all] [-R,--recursive] [--environment #0] [--json] [--severity #0] [--exclude #0] [--ignore #0]\n' +
    '$ yarn npm info [-f,--fields #0] [--json] ...\n' +
    '$ yarn npm login [-s,--scope #0] [--publish] [--always-auth]\n' +
    '$ yarn npm logout [-s,--scope #0] [--publish] [-A,--all]\n' +
    '$ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish] [--otp #0]\n' +
    '$ yarn npm tag add <package> <tag>\n' +
    '$ yarn npm tag list [--json] [package]\n' +
    '$ yarn npm tag remove <package> <tag>\n' +
    '$ yarn npm whoami [-s,--scope #0] [--publish]\n' +
    '$ yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]\n' +
    '$ yarn patch-commit [-s,--save] <patchFolder>\n' +
    '$ yarn patch [--json] <package>\n' +
    '$ yarn unplug [-A,--all] [-R,--recursive] [--json] ...',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false,
  signal: undefined
}
Failed to load @next/swc binary packages

Expected Behavior

Script installs the @next/swc binary packages

Which browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

N/A

@syedtaqi95 syedtaqi95 added the bug Issue was opened via the bug report template. label Jul 20, 2023
@github-actions github-actions bot added the SWC Related to minification/transpilation in Next.js. label Jul 20, 2023
@kodiakhq kodiakhq bot closed this as completed in #52971 Jul 21, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 21, 2023
fixes #52970

Yarn 3 has removed the "--force" flag. This can cause issues with building the Next.js repository if Yarn 3 is activated on a development machine (specifically the postinstall script "install-native.mjs"). Using pnpm as the package manager fixes this issue.
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant