Cant run wasm module on cmd. Error: failed to run main module `demo.wasm`

326 views Asked by At

Hi I'm new in programing in general I know just web dev. So I'm interested in develop in rust ussing webassembly wasm, wasmp-pack, webpack, wasi and in this case the runtime demo of wasmtime but Im stuck here and seriously I dont know even where to look to begin with so, heres the error...

Error: failed to run main module `demo.wasm`

Caused by:
    0: failed to read `demo.wasm` to a string
    1: The system cannot find the file specified. (os error 2)

wasmtime 0.20.0
Wasmtime WebAssembly Runtime```

Im running 
windows 10
using cmd 
rustup

Thanks
2

There are 2 answers

0
alberto flores On

The syntax I was using its wrong!!!!!

'''demo>wasmtime .\target\wasm32-wasi\debug\demo.wasm'''

'''Hello, world!'''

At the begging it appears that wasmtime needs to be invoke to initialize from the root folder that you installed and the go and run the path

This its a recurring thing for me using cmd to run frameworks programs developed with bash or terminal in mind its hell on windows I hope that this serves well to ALL developers. Young or old, inexperienced or bash users stuck in a windows cmd for the day.

Funny thing if you take that same command and remove wasmtime from the beginning it shows you the actual source code of the module in whatever program you have configure to open wasm files and if you dont have one prompts you an alert that there is not such program bind to the file extension.

So the command works for cmd only and if you notice its all backslashes which its the opposite of bash but wait, not always!

So this is just ANOTHER configuration that happens to work with wamstime. But what is this? Is it regular expressions?

0
pushStack On

In my case, there where no .wasm file matching the wasmtime first argument.