ITK-JS && ITK-WASM

@matt.mccormick

Hi Mat,

I am trying to use both ITK-JS and ITK-WASM. I have failed in both. please help me with following questions:

+I have followed this Node.js HelloWorld, and i failed with the error cannot find module itk/runPipelineNode? npx itk-wasm build worked like a charm
+++I have installed itk-wasm in my node.js project(npm install --save-dev itk-wasm)).
++I can see that inside package.json. I am not sure why node.js cannot find the itk/runPipelineNode module? is it part of node.js? I see in node_modules runPipelineNode.ts but i am not sure if there is a binary of that API?
++I have installed ITK/C++ on windows and it is inside c:\Program files\ITK folder! and this couple of years ago.
+++++what am i doing wrong?

BR
@sag

Please try this Hello World example.
That’s an old link. I also ran into this issue last week :grinning:

1 Like

Hi Pranjal_Sahu,

I appreciate your answer about hello-world for itkwasi. I did try it but still i could not get it to work. it went well untill running following command:
itk-wasi -b .\web-wasi\ run .\hello.wasi.wasm

it seems not finding .wasi\itk-wasm-build-env. you can see it in the screenshot i have attached. docker image itkwasm/wasi is also download ed and i think it should be okay. the text [Hello WASM world!] did not appear in the terminal of vscode. I am not sure what would be wrong?! any ideas?
Node.js & Browser version did not work either. it does not print the [Hello WASM world!] in the termial.
there are two screen shots attached down below: 1. hello-world project in vscode 2. docker dashboard showing itkwasm/emscripten & itkwasm/wasi images which are download from docker hub. these are toolchains the WASM provided to build WASM & WASI executable to run with [itk-wasm] and [npx node] together.
I hope i did not get you lost with this long email.
BR
sohrab


HI Pranjal Sahu,

I appreciate you emailing me. I did try the examples in the link but all was failure. I did send you a comprehensive response on ITK discussion froum, i hope
you could take a look at it if you have time and give me some pointers how did you go about it and make it work.

thanks
sohrab


Works for me on linux.
Can you please check if all the build files are present in the folder wasi-build ?

It works for me on linux.

@Albers_Steven , @Pranjal_Sahu ,

Hi,
it is still not working for me. WSL Ubuntu 20.04.2 which is a linux windows subsystem builds the hello.wasi.wasm but when i run it, i get some issue inside itk-wasm. this is related to file access on file system. I get the error. ((import fs from ‘fs-extra’)) undefined syntax error. there is a gigling line under fs. when wasi version is created meaning a javascript wrapper around c++ is created which we call from linux. there must be an enviroment issue. I have installed node.js, nvm, WSL2 linux, my wsl2 linux is like a docker virtual machine which gives you opportunity to even have UI Graphics interface using windows X server to launch even android studio or anyother cartoons like xeyes on it, but that is besides the point, BUT I CANNOT RUN A SIMPLE WASI ON IT?

One more question can you tell me what are you environment setup ?

  1. docker installed running without using sudo.
    2.node.js installed ( I CAN RUN NODE.JS, I GUESS)
  2. I installed even nvm to nvm use any version of the node.js!
  3. installed npm
  4. try to install fs-extra and i see that in linux /usr/local/bin/node_mosules/…/ITK-WASM/…
    nothing helps. what is you environment in linux ?

CAN YOU TRY TO RUN FROM INSIDE DOCKER LINUX MACHINE?
may be that is my problem? i think that must be it.

@sag
still i get import fs from ‘fs-extra’

Maybe you can test on a linux machine.

I works for me on linux and MacOS.

So 99% that problem is your local environment setup.

Hi Albers,

Thanks for the response. I finally managed to run the wasi version of hello world. I did reinstall my big sur OS which sort of make sure software work for macOS. then I installed nvm, node’s, docker desktop on my Mac. I did use nvm packet manager to keep track of my software inside the Mac.
through nvm use v17.1.0 I got to get the latest nodes and along with that I got nvm@8.12.2 which I guess solved my issue. then I build everything my docker built was-build and I could run hello world app and see the results on the nodes terminal.
now I am having issues with nodes version. I did built it correctly using its-wasm build. I did check my docker dashboard and its-wasm/emscripten was one of pulled images. I know the build Is correct checking because I have all the files in web-build.
I created index.mjs to run a module and this is inside the article now it complains hello.js has export default hello; at the end of the hello.js file. unexpected token ‘export’.
any idea why would a ESCMAScript get problematic when we runPiepelineNode(…).
this is on macOS! can you tell me what is in your environment.
by the way I am using the example in this url:
Hello WASM World! | itk-wasm which was suggested by pranks_sahu.
any idea or what might be wrong with index.mjs or my babel is old version or what is going on?

@sag

hi albers,

my typo in the explanation, replace nvm@8.12.2 with npm@8.12.2