nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.31k stars 145 forks source link

Windows11 build failed #493

Closed liwakin closed 3 weeks ago

liwakin commented 3 weeks ago

Hello, I am currently trying to build Corepack on my Windows 11 machine using Git Bash, following the steps outlined in the CONTRIBUTING.md file. However, I am encountering some errors during the process.

Here are the steps I have taken:

$ node -v
v20.14.0
$ yarn -v
4.1.1
$ git clone https://github.com/leewakin/corepack.git
Cloning into 'corepack'...
remote: Enumerating objects: 4355, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 4355 (delta 13), reused 21 (delta 6), pack-reused 4313
Receiving objects: 100% (4355/4355), 773.75 MiB | 10.63 MiB/s, done.
Resolving deltas: 100% (1537/1537), done.
$ cd corepack
$ yarn install
➤ YN0000: · Yarn 4.1.1
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ better-sqlite3@npm:9.6.0 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.19.5 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 1s 361ms
➤ YN0000: · Done with warnings in 1s 706ms
$ yarn build
X [ERROR] Could not resolve "clipanion"

    sources/main.ts:1:44:
      1 │ import {BaseContext, Builtins, Cli}    from 'clipanion';
        ╵                                             ~~~~~~~~~~~

  You can mark the path "clipanion" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "clipanion"

    sources/commands/Use.ts:1:42:
      1 │ import {Command, Option, UsageError} from 'clipanion';
        ╵                                           ~~~~~~~~~~~

  You can mark the path "clipanion" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "clipanion"

    sources/commands/deprecated/Hydrate.ts:1:42:
      1 │ import {Command, Option, UsageError} from 'clipanion';
        ╵                                           ~~~~~~~~~~~

  You can mark the path "clipanion" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "clipanion"

    sources/commands/Disable.ts:1:78:
      1 │ ..., UsageError}                                     from 'clipanion';
        ╵                                                           ~~~~~~~~~~~

  You can mark the path "clipanion" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "which"

    sources/commands/Disable.ts:4:78:
      4 │ ...                                                      from 'which';
        ╵                                                               ~~~~~~~

  You can mark the path "which" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

X [ERROR] Could not resolve "tar"

    sources/commands/deprecated/Hydrate.ts:27:40:
      27 │     const {default: tar} = await import(`tar`);
         ╵                                         ~~~~~

  You can mark the path "tar" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.

6 of 36 errors shown (disable the message limit with --log-limit=0)
node:internal/errors:984
  const err = new Error(message);
              ^

Error: Command failed: D:\code\corepack\.yarn\unplugged\@esbuild-win32-x64-npm-0.19.5-1e2e5abaa6\node_modules\@esbuild\win32-x64\esbuild.exe ./sources/_lib.ts --bundle --platform=node --target=node18.17.0 --external:corepack --outfile=./dist/lib/corepack.cjs --resolve-extensions=.ts,.mjs,.js
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at Object.execFileSync (node:child_process:926:15)
    at Object.<anonymous> (D:\code\corepack\.yarn\unplugged\esbuild-npm-0.19.5-107ce8536d\node_modules\esbuild\bin\esbuild:220:28)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at require$$0.Module._extensions..js (D:\code\corepack\.pnp.cjs:13384:33)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 8808,
  stdout: null,
  stderr: null
}

Node.js v20.14.0

Unfortunately, I am stuck at this point and could use some guidance. Any help would be greatly appreciated. Thank you in advance for your time and assistance.

liwakin commented 3 weeks ago

This issue is the same as the one described in https://github.com/evanw/esbuild/issues/3131. I've managed to temporarily resolve it by setting enableGlobalCache: false.