microsoft / mixed-reality-extension-sdk-samples

Sample code for the Mixed Reality Extension SDK (https://github.com/Microsoft/mixed-reality-extension-sdk)
MIT License
92 stars 82 forks source link

Running the samlpes on WSL2 (Ubuntu) #58

Open mheiniger opened 4 years ago

mheiniger commented 4 years ago

When i clone and run the examples according to the readme on Windows, it shows the rotating Hello World! text and also the AltspaceVR box underneath. When i do the same on WSL2 in Ubuntu, it just shows the rotating text, but no box. Also in the other examples it only shows the text.

The only thing that looks different in the console is during the npm run build where it shows:

/home/mhe/code/mixed-reality-extension-sdk-samples/samples/hello-world/src/app.ts
    1:4    warning  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style
    2:61   warning  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style
    3:35   warning  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style
    ...
mheiniger commented 4 years ago

Ok, I found the problem, its WSL2 specific: http://127.0.0.1:3901/altspace-cubes.glb does not work on WSL2, http://localhost:3901/altspace-cubes.glb does work. It looks as if new WebHost() uses 127.0.0.1 by default.

By adding baseUrl: 'http://localhost:3901', here: https://github.com/microsoft/mixed-reality-extension-sdk-samples/blob/5be14ed370fae0e5389c6a12582f3f48064a814a/samples/hello-world/src/server.ts#L26 it works as intended.