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

Bundling with pkg #104

Open
olizilla opened this issue Oct 6, 2023 · 1 comment
Open

Bundling with pkg #104

olizilla opened this issue Oct 6, 2023 · 1 comment

Comments

@olizilla
Copy link
Contributor

olizilla commented Oct 6, 2023

pkg fails to bundle w3cli.

I'm using this issue to track pkg specific bundling issues, and will use #82 to track the more general bundling plan

❯ npx pkg ./bin.js -t node18-mac
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
> [email protected]
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules/open/xdg-open
  %2: path-to-executable/xdg-open
> Warning Entry 'main' not found in %1
  %1: /Users/oli/Code/web3-storage/w3cli/node_modules/multiformats/package.json
  %2: /Users/oli/Code/web3-storage/w3cli/index.js
> Warning Cannot find module '@ipld/dag-ucan/did' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/index.js
> Warning Entry 'main' not found in %1
  %1: /Users/oli/Code/web3-storage/w3cli/node_modules/@ipld/car/package.json
  %2: /Users/oli/Code/web3-storage/w3cli/index.js
> Warning Entry 'main' not found in %1
  %1: /Users/oli/Code/web3-storage/w3cli/node_modules/multiformats/package.json
  %2: /Users/oli/Code/web3-storage/w3cli/can.js
> Warning Cannot find module '@ucanto/core/delegation' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Cannot find module '@ucanto/transport/car' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Cannot find module '@ucanto/transport/http' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Cannot find module '@ucanto/principal/ed25519' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Entry 'main' not found in %1
  %1: /Users/oli/Code/web3-storage/w3cli/node_modules/multiformats/package.json
  %2: /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Cannot find module '@ipld/dag-ucan/did' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Cannot find module '@web3-storage/access/stores/store-conf' from '/Users/oli/Code/web3-storage/w3cli'  in /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Entry 'main' not found in %1
  %1: /Users/oli/Code/web3-storage/w3cli/node_modules/@ipld/car/package.json
  %2: /Users/oli/Code/web3-storage/w3cli/lib.js
> Warning Babel parse has failed: import.meta may appear only with 'sourceType: "module"' (222:40)
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/bin.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/can.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/ora/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/core/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/did-mailto/src/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/chalk/source/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/ora/node_modules/cli-cursor/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/is-interactive/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/is-unicode-supported/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/log-symbols/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/stdin-discarder/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/strip-ansi/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/client/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/chalk/source/utilities.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/ora/node_modules/restore-cursor/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/ansi-regex/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/base.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/client.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/delegation.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/service.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/space.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/capability/access.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/capability/space.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/capability/store.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/w3up-client/src/capability/upload.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/transport/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/access/src/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/did.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/formatter.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/parser.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/schema.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/signature.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/utf8.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/view.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/codec/cbor.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/dag-ucan/src/codec/jwt.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/absentee.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/ed25519.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/multiformat.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/signer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/verifier.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa/asn1.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa/pkcs8.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa/private-key.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa/public-key.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/principal/src/rsa/spki.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/validator/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/inquirer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/p-defer/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/p-wait-for/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/car.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/constants.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/service.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/sharding.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/store.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/unixfs.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/upload-client/src/upload.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/p-retry/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/access.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/admin.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/console.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/consumer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/customer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/filecoin.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/provider.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/rate-limit.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/space.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/store.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/subscription.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/top.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/upload.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/capabilities/src/utils.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@web3-storage/data-segment/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/validator/src/capability.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/validator/src/error.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ucanto/validator/src/util.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/objects/choice.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/objects/choices.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/objects/separator.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/base.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/checkbox.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/confirm.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/editor.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/expand.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/input.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/list.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/number.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/password.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/prompts/rawlist.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/ui/baseUI.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/ui/bottom-bar.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/ui/prompt.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/events.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/incrementListIndex.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/paginator.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/readline.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/screen-manager.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/inquirer/lib/utils/utils.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/figures/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/p-wait-for/node_modules/p-timeout/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/codec.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/directory.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/unixfs.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/chunker.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/writer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/writer/util.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/chunker/buffer.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/chunker/fixed.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/chunker/indexed.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/layout/balanced.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/src/file/layout/queue.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@ipld/unixfs/gen/unixfs.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/actor/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/rabin-rs/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/fetch.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/p-timeout/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/sync-multihash-sha2/src/lib.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/escape-string-regexp/index.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/api.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/node.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/bitfield/Uint32.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/bitfield/Uint8Array.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/bitfield/api.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/path/Uint32.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/path/Uint8Array.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/@perma/map/src/path/api.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/actor/src/task.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/rabin-rs/gen/wasm.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/ArrayBufferResponse.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/BlobResponse.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/Body.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/Fetch.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/Headers.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/Request.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/Response.js
> Warning Failed to make bytecode node18-arm64 for file /snapshot/w3cli/node_modules/react-native-fetch-api/src/utils.js
@olizilla
Copy link
Contributor Author

olizilla commented Oct 6, 2023

using esbuild to create single cjs bundle of w3cli before running pkg works better, but reveals the trickery of ipfs-utils

$ esbuild bin.js --platform=node --outfile=esbin.cjs --bundle
▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]

    lib.js:27:62:
      27 │   return JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url)))
         ╵                                                               ~~~~~~~~~~~

  You need to set the output format to "esm" for "import.meta" to work correctly.

1 warning

  esbin.cjs  1.7mb ⚠️

⚡ Done in 68ms

$ node esbin.cjs
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module './fetch.node'
Require stack:
- /Users/oli/Code/web3-storage/w3cli/esbin.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at node_modules/ipfs-utils/src/http/fetch.js (/Users/oli/Code/web3-storage/w3cli/esbin.cjs:15766:18)
    at __require (/Users/oli/Code/web3-storage/w3cli/esbin.cjs:10:51)
    at Object.<anonymous> (/Users/oli/Code/web3-storage/w3cli/esbin.cjs:45202:28)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/oli/Code/web3-storage/w3cli/esbin.cjs' ]
}

Node.js v18.18.0

but of note, pkg much happier to compile it (notice the different node version in the error, such magic)

$ pkg esbin.cjs
> [email protected]
> Targets not specified. Assuming:
  node18-linux-arm64, node18-macos-arm64, node18-win-arm64
> Warning Cannot resolve 'implName'
  /Users/oli/Code/web3-storage/w3cli/esbin.cjs
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.

❯ ./esbin-macos
pkg/prelude/bootstrap.js:1872
      throw error;
      ^

Error: Cannot find module './fetch.node'
Require stack:
- /snapshot/w3cli/esbin.cjs
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46)
    at Module._load (node:internal/modules/cjs/loader:787:27)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at node_modules/ipfs-utils/src/http/fetch.js (/snapshot/w3cli/esbin.cjs)
    at __require (/snapshot/w3cli/esbin.cjs)
    at Object.<anonymous> (/snapshot/w3cli/esbin.cjs)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/snapshot/w3cli/esbin.cjs' ],
  pkg: true
}

Node.js v18.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant