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

hello world tutorial error #781

Closed
finetjul opened this issue Mar 5, 2023 · 5 comments · Fixed by #829
Closed

hello world tutorial error #781

finetjul opened this issue Mar 5, 2023 · 5 comments · Fixed by #829

Comments

@finetjul
Copy link

finetjul commented Mar 5, 2023

In the hello world tutorial, a folder named wasi-build is referenced. I personally (on Windows 11 , VSCode, git bash, [email protected]) have only an emscripten-build folder, no wasi-build folder.

❯ npx itk-wasm run wasi-build/hello.wasi.wasm
Hello Wasm world!

It builds into the correct wasi-build folder with [email protected].

You might want to update the tutorial documentation accordingly.

@finetjul
Copy link
Author

finetjul commented Mar 5, 2023

Other problem I had on Windows: in loadEmscriptenModuleNode.js, I had to replace const fullModulePath = `${modulePrefix}.js`; with const fullModulePath = `file://${modulePrefix}.mjs`; and renaming hello.js into hello.mjs in emscripten-build.

First error:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Second error:

(node:25640) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
C:\Work\wasm\hello_world\emscripten-build\hello.js:3
  var _scriptDir = import.meta.url;
                          ^^^^

SyntaxError: Cannot use 'import.meta' outside a module

@finetjul
Copy link
Author

finetjul commented Mar 5, 2023

Finally, here is the WASI error when trying to run the build:

PS C:\Work\wasm\hello_world> npx itk-wasm run wasi-build/hello.wasi.wasm
ERROR: Unknown option "--args,-e"

Usage: dockcross [options] [--] command [args]

By default, run the given *command* in an dockcross Docker container.

The *options* can be one of:

    --args|-a           Extra args to the *docker run* command
    --image|-i          Docker cross-compiler image to use
    --config|-c         Bash script to source before running this script


Additionally, there are special update commands:

    update-image
    update-script
    update

For update command help use: wasi-build/itk-wasm-build-env help <command>
undefined

@thewtex
Copy link
Member

thewtex commented Mar 9, 2023

@finetjul thanks for the report!

For the first issue, here is a patch: #784

I will attempt to reproduce the others once on a Windows system.

thewtex added a commit to thewtex/ITK-Wasm that referenced this issue May 5, 2023
Addresses:

> ERROR: Unknown option "--args,-e"

Reported in InsightSoftwareConsortium#781.
thewtex added a commit to thewtex/ITK-Wasm that referenced this issue May 5, 2023
Addresses:

> ERROR: Unknown option "--args,-e"

Reported in InsightSoftwareConsortium#781.
thewtex added a commit to thewtex/ITK-Wasm that referenced this issue May 5, 2023
Addresses:

> ERROR: Unknown option "--args,-e"

Reported in InsightSoftwareConsortium#781.
github-actions bot pushed a commit that referenced this issue May 5, 2023
# [1.0.0-b.104](itk-wasm-v1.0.0-b.103...itk-wasm-v1.0.0-b.104) (2023-05-05)

### Bug Fixes

* **CLI:** Run invocation on Windows ([21f6b9a](21f6b9a)), closes [#781](#781)
thewtex added a commit to thewtex/ITK-Wasm that referenced this issue May 7, 2023
@thewtex
Copy link
Member

thewtex commented May 8, 2023

Addressed with #829 via #826 #798 #824

@github-actions
Copy link

🎉 This issue has been resolved in version 1.0.0-b.107 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants