petersalomonsen / wasm-git

GIT for nodejs and the browser using https://libgit2.org compiled to WebAssembly with https://emscripten.org
Other
647 stars 37 forks source link

Trying to run it #60

Closed iliakan closed 1 year ago

iliakan commented 1 year ago

I'm on MacOS Ventura, unfortunately couldn't build it.

So I used npm i wasm-git in a temporary folder and copied over lg2.js and lg2.wasm over the files here.

Then I executed:

node webserverwithgithubproxy.js

Although, in Chrome at http://localhost:5000 see error:

Uncaught (in promise) ErrnoError {node: undefined, errno: 44, message: 'FS error', stack: '<generic error, no stack>', setErrno: ƒ}

Here's the screenshot:

image

What I did wrong? Any ideas?

petersalomonsen commented 1 year ago

yeah, this is probably not very clear from any docs, but you need to change the path of the URL where it clones from to match one of a github repo.

You can find the clone command in the webworker here: https://github.com/petersalomonsen/wasm-git/blob/master/examples/example_webworker.js#L16

currently it says:

lg.callMain(['clone','http://localhost:5000/test', 'testrepo']);

but if you change it to:

lg.callMain(['clone','http://localhost:5000/petersalomonsen/wasm-git.git', 'testrepo']);

then it will clone wasm-git repo from github through localhost.

iliakan commented 1 year ago

Oh, right, I just expected it to work "as provided".

Now it did execute, thanks! ;)

petersalomonsen commented 1 year ago

yeah sorry, it should have been working "as provided", so better put that on the todo list to fix.