Skip to content

Using Node.js 20, rake npm:ruby-head-wasm-wasi:check does not work #314

Open
@ledsun

Description

@ledsun

What happened.

I installed Node.js 20.8.0 and ran rake npm:ruby-head-wasm-wasi:check and got the following error:

►rake npm:ruby-head-wasm-wasi:check
npm test

> ruby-head-wasm-wasi@2.2.0 test
> RUBY_NPM_PACKAGE_ROOT=../ruby-head-wasm-wasi npm -C ../ruby-wasm-wasi run test:run


> @ruby/wasm-wasi@2.2.0 test:run
> npm run test:unit && npm run test:jest && npm run test:e2e


> @ruby/wasm-wasi@2.2.0 test:unit
> ./tools/run-test-unit.mjs

(node:66391) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.version" property must be of type string. Received undefined
    at new NodeError (node:internal/errors:406:5)
    at validateString (node:internal/validators:162:11)
    at new WASI (node:wasi:51:5)
    at instantiateNodeWasi (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs:30:16)
    at async test (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs:128:24)
    at async main (file:///home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi/tools/run-test-unit.mjs:162:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.8.0
npm ERR! Lifecycle script `test:unit` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @ruby/wasm-wasi@2.2.0
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: ruby-head-wasm-wasi@2.2.0
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi
rake aborted!
Command failed with status (1): [npm test]
/home/ledsun/ruby.wasm/tasks/packaging.rake:21:in `block (4 levels) in <top (required)>'
Tasks: TOP => npm:ruby-head-wasm-wasi:check
(See full trace by running task with --trace)

It worked fine using Node.js 18.8.2.

What I tried

Added version property to the argument of the WASI constructor.

const wasi = new nodeWasi.WASI({
stdio: "inherit",
args: ["ruby.wasm"].concat(process.argv.slice(2)),
env: {
...process.env,
// Extend fiber stack size to be able to run test-unit
"RUBY_FIBER_MACHINE_STACK_SIZE": String(1024 * 1024 * 20),
},
preopens,
});

I have tried both unstable and preview1 according to https://nodejs.org/docs/latest-v20.x/api/wasi.html.
The test ended with a Segmentation fault.

ledsun@MSI:~/ruby.wasm►rake npm:ruby-head-wasm-wasi:check
npm test

> ruby-head-wasm-wasi@2.2.0 test
> RUBY_NPM_PACKAGE_ROOT=../ruby-head-wasm-wasi npm -C ../ruby-wasm-wasi run test:run


> @ruby/wasm-wasi@2.2.0 test:run
> npm run test:unit && npm run test:jest && npm run test:e2e


> @ruby/wasm-wasi@2.2.0 test:unit
> ./tools/run-test-unit.mjs

(node:68755) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Ignoring debug-1.8.0 because its extensions are not built. Try: gem pristine debug --version 1.8.0
Ignoring racc-1.7.3 because its extensions are not built. Try: gem pristine racc --version 1.7.3
Ignoring rbs-3.3.2 because its extensions are not built. Try: gem pristine rbs --version 3.3.2
Loaded suite /__root__/test/test_unit
Started
Segmentation fault
npm ERR! Lifecycle script `test:unit` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @ruby/wasm-wasi@2.2.0
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-wasm-wasi
npm ERR! Lifecycle script `test` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: ruby-head-wasm-wasi@2.2.0
npm ERR!   at location: /home/ledsun/ruby.wasm/packages/npm-packages/ruby-head-wasm-wasi
rake aborted!
Command failed with status (1): [npm test]
/home/ledsun/ruby.wasm/tasks/packaging.rake:21:in `block (4 levels) in <top (required)>'
Tasks: TOP => npm:ruby-head-wasm-wasi:check
(See full trace by running task with --trace)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions