Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
605 stars 27 forks source link

'errno 28' #76

Open wan-may opened 1 year ago

wan-may commented 1 year ago

Hello,

I used LOVE for the first time recently. The game works on Windows 10. I couldn't get it working for the web, and I don't know why.

I used love.js.cmd to build. It throws no errors at build time. I allocated different amounts of memory, tried the compatibility flag, switched all my audio between "static" and "shared" and back, made sure the fragment shader worked in OpenGLES. Nothing seems to work. It just throws 'errno 28' in the middle of some giant obfuscated line of javascript.

I tested the web version by uploading it to itch.io. My browser is Waterfox G5.1.2 (64 bits). I'm using LOVE version 11.4.

I took the build down because it wasn't working, but the source code (as a .love file) can be downloaded here: https://wan-may.itch.io/your-own-drum. I'm sorry I don't have a smaller reproducible example, I'm very unfamiliar with LOVE and the web, so I have no idea where to start narrowing down where the problem might be. Can someone please take a look?

lenaschimmel commented 1 year ago

I got the same error, no matter if I tried it with our full game, or with the minimal love example which only has a main.lua with this content:

function love.draw()
    love.graphics.print("Hello World", 400, 300)
end

My setup:

The actual error message looks a bit different on my two browsers, especially the stack trace.

Firefox:

Object {
node: undefined, 
setErrno: setErrno(errno), 
errno: 28, 
message: "FS error", 
stack: "ensureErrnoError@https://localhost/love.js:9:92373\nstaticInit@https://localhost/love.js:9:92593\nLove@https://localhost/love.js:9:343062\napplicationLoad@https://localhost/index.html:102:13\nonload@https://localhost/index.html:1:16\n" 
}

Chrome:

ErrnoError {node: undefined, errno: 28, message: 'FS error', setErrno: ƒ}
  | mknod | @ | love.js:9
  | create | @ | love.js:9
  | createDataFile | @ | love.js:9
  | finish | @ | game.js:118
  | onload | @ | game.js:112
  | processPackageData | @ | game.js:236
  | putMetadataRequest.onsuccess | @ | game.js:209
  | IndexedDB (async) |   |  
  | putPackageRequest.onsuccess | @ | game.js:207
  | IndexedDB (async) |   |  
  | cacheRemotePackage | @ | game.js:203
  | (anonymous) | @ | game.js:263
  | xhr.onload | @ | game.js:76
  | load (async) |   |  
  | fetchRemotePackage | @ | game.js:73
  | (anonymous) | @ | game.js:261
  | getRequest.onsuccess | @ | game.js:175
  | IndexedDB (async) |   |  
  | checkCachedPackage | @ | game.js:171
  | (anonymous) | @ | game.js:253
  | openRequest.onsuccess | @ | game.js:159
  | IndexedDB (async) |   |  
  | openDatabase | @ | game.js:140
  | runWithFS | @ | game.js:251
  | callRuntimeCallbacks | @ | love.js:9
  | preRun | @ | love.js:9
  | run | @ | love.js:9
  | runCaller | @ | love.js:9
  | removeRunDependency | @ | love.js:9
  | (anonymous) | @ | love.js:9
  | worker.onmessage | @ | love.js:9

Safari output was very similar, but had problems copying it, so it's not included.

DMClVG commented 11 months ago

You have to refrain from using directories such as "." or ".." for the game directory when compiling using love.js. I moved my game from the current directory to a subdirectory and (in my case) it works well now

ChicknTurtle commented 4 months ago

You have to refrain from using directories such as "." or ".." for the game directory when compiling using love.js. I moved my game from the current directory to a subdirectory and (in my case) it works well now

This did not solve my issue. I am getting errno 20, not 28, but very similar issue. Before: love.js ./ packaged-game -t game -c -m 100000000 After: love.js src packaged-game -t game -c -m 100000000

love.js:9 Uncaught ErrnoError {node: undefined, errno: 20, message: 'FS error', stack: '<generic error, no stack>', setErrno: ƒ}
ChicknTurtle commented 4 months ago

This is where the error is coming from:

            mknod: function(path, mode, dev) {
                var lookup = FS.lookupPath(path, {
                    parent: true
                });
                var parent = lookup.node;
                var name = PATH.basename(path);
                if (!name || name === "." || name === "..") {
                    throw new FS.ErrnoError(28)
                }
                var errCode = FS.mayCreate(parent, name);
                if (errCode) {
                    throw new FS.ErrnoError(errCode)
                }
                if (!parent.node_ops.mknod) {
                    throw new FS.ErrnoError(63)
                }
                return parent.node_ops.mknod(parent, name, mode, dev)
            },

When commenting out the line that throws the error, I get a new error:

game.js:292 Uncaught TypeError: Cannot read properties of null (reading 'onload')
    at processPackageData (game.js:292:61)
    at putMetadataRequest.onsuccess (game.js:265:11)
function processPackageData(arrayBuffer) {
                Module.finishedDataFileDownloads++;
                assert(arrayBuffer, 'Loading data file failed.');
                assert(arrayBuffer instanceof ArrayBuffer, 'bad input to processPackageData');
                var byteArray = new Uint8Array(arrayBuffer);
                var curr;

                // copy the entire loaded file into a spot in the heap. Files will refer to slices in that. They cannot be freed though
                // (we may be allocating before malloc is ready, during startup).
                if (Module['SPLIT_MEMORY'])
                    Module.printErr('warning: you should run the file packager with --no-heap-copy when SPLIT_MEMORY is used, otherwise copying into the heap may fail due to the splitting');
                var ptr = Module['getMemory'](byteArray.length);
                Module['HEAPU8'].set(byteArray, ptr);
                DataRequest.prototype.byteArray = Module['HEAPU8'].subarray(ptr, ptr + byteArray.length);

                var files = metadata.files;
                for (i = 0; i < files.length; ++i) {
                    DataRequest.prototype.requests[files[i].filename].onload(); // << error on this line
                }
                Module['removeRunDependency']('datafile_game.data');

            }
            ;Module['addRunDependency']('datafile_game.data');