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

Marp CLI 3.0.0 standalone binary is missing setup-sandbox.js #524

Closed
silkeh opened this issue Jun 11, 2023 · 3 comments · Fixed by #525
Closed

Marp CLI 3.0.0 standalone binary is missing setup-sandbox.js #524

silkeh opened this issue Jun 11, 2023 · 3 comments · Fixed by #525
Labels
bug Something isn't working

Comments

@silkeh
Copy link

silkeh commented Jun 11, 2023

Version of Marp Tool

3.0.0

Operating System

Linux

Environment

  • OS version: Debian 11, Solus
  • Node.js version (Marpit / Marp Core/ Marp CLI): v18.5.0 (bundled with release)
  • VS Code version (Marp for VS Code): n/a

How to reproduce

  1. Download binary from releases page or build from source
  2. Run ./marp --version (or any other marp command)

Expected behavior

Shows the version, eg:

$ marp --version
@marp-team/marp-cli v2.5.0 (w/ @marp-team/marp-core v3.6.0)

Actual behavior

$ marp --version
pkg/prelude/bootstrap.js:1872
      throw error;
      ^

Error: File '/**/marp-cli/node_modules/vm2/lib/setup-sandbox.js' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    at error_ENOENT (pkg/prelude/bootstrap.js:657:19)
    at readFileFromSnapshot (pkg/prelude/bootstrap.js:1046:29)
    at Object.readFileSync (pkg/prelude/bootstrap.js:1094:18)
    at Object.<anonymous> (/snapshot/marp-cli/node_modules/vm2/lib/vm.js:148:57)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31) {
  errno: -2,
  code: 'ENOENT',
  path: '/snapshot/marp-cli/node_modules/vm2/lib/setup-sandbox.js',
  pkg: true
}

Node.js v18.5.0

Additional information

No response

@silkeh silkeh added the bug Something isn't working label Jun 11, 2023
@yhatt
Copy link
Member

yhatt commented Jun 11, 2023

Related: vercel/pkg#1812

This error should not bring when executing from source code through npx @marp-team/marp-cli@3.0.0 (Local installation).

@yhatt yhatt changed the title Marp 3.0.0 for Linux is missing setup-sandbox.js Marp CLI 3.0.0 standalone binary for Linux is missing setup-sandbox.js Jun 11, 2023
@jans-code
Copy link

jans-code commented Jun 12, 2023

This is not only an error with the linux binary.
I have this with the linux binary under Archlinux (same error as silkeh) and also with the windows binary.

pkg/prelude/bootstrap.js:1872
      throw error;
      ^

Error: File 'C:\**\marp-cli\node_modules\vm2\lib\setup-sandbox.js' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    at error_ENOENT (pkg/prelude/bootstrap.js:657:19)
    at readFileFromSnapshot (pkg/prelude/bootstrap.js:1046:29)
    at Object.readFileSync (pkg/prelude/bootstrap.js:1094:18)
    at Object.<anonymous> (C:\snapshot\marp-cli\node_modules\vm2\lib\vm.js:148:57)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:834:12)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31) {
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\snapshot\\marp-cli\\node_modules\\vm2\\lib/setup-sandbox.js',
  pkg: true
}

Node.js v18.5.0

@yhatt yhatt changed the title Marp CLI 3.0.0 standalone binary for Linux is missing setup-sandbox.js Marp CLI 3.0.0 standalone binary is missing setup-sandbox.js Jun 12, 2023
@yhatt
Copy link
Member

yhatt commented Jun 12, 2023

Probably a packaged binary by pkg is not yet available dynamic import for ESM.
vercel/pkg#1291

We must adopt the traditional way require() if Marp CLI is run via the standalone binary (Detectable with process.pkg). In this case, the engine cannot be ESM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants