Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "FS is not defined" #69

Open
sorskoot opened this issue May 11, 2018 · 8 comments
Open

Error: "FS is not defined" #69

sorskoot opened this issue May 11, 2018 · 8 comments

Comments

@sorskoot
Copy link

This is the actual error shown in the console:
artoolkit.api.js:1670 Uncaught ReferenceError: FS is not defined
at writeByteArrayToFS (artoolkit.api.js:1670)
at XMLHttpRequest.oReq.onload (artoolkit.api.js:1689)

It points to this function in artoolkit.api.js:
function writeByteArrayToFS(target, byteArray, callback) {
FS.writeFile(target, byteArray, { encoding: 'binary' });
// console.log('FS written', target);
callback(byteArray);
}
Is there any way to get this fixed? For now I added FS.writeFile as an empty function to the global scope to get rid of the error.

@ThorstenBux
Copy link

@sorskoot: Same here please list the steps that you are taking until this error occurs, thanks.

@pikilipita
Copy link

I had the same issue, it is happening after reloading a page several times on Android/Chrome.
My guess is that Chrome does not free all the memory used when reloading a page.

@nicolocarpignoli
Copy link

someone could look at this? same error
#83

@kalwalt
Copy link

kalwalt commented Jun 25, 2019

As posted on my branch-PR probably this is a "emscripten" issue the problem is described here: emscripten-core/emscripten#854 and https://stackoverflow.com/questions/15056752/emscripten-using-filesystem-fs

@nicolocarpignoli
Copy link

So maybe the fact that the flow did not 'arrive' till a FS function call, meant that FS was not imported at all. Great, thanks!

@kalwalt
Copy link

kalwalt commented Jun 25, 2019

So maybe the fact that the flow did not 'arrive' till a FS function call, meant that FS was not imported at all. Great, thanks!

@nicolocarpignoli yes, but the fact remains that the code works for me but not for you, This puzzling me a lot...

@andypotato
Copy link

I'm running into the same issue with my own build now.

From what I found this is not related to Node.js or but actually a reference to Emscripten's own FS module as described here.

Their API seems to have changed now. Reading the documentation I'd expect an FS object to be available on the generated module but I can only see methods like FS_createFolder or FS_createDataFile. Also this API must be enabled by building the module with -s FORCE_FILESYSTEM=1

In case anyone has already solved this, how did you do it?

@andypotato
Copy link

Solved ... you need to add this to your emscripten module build configuration:

FLAGS += ' -s "EXTRA_EXPORTED_RUNTIME_METHODS=[\'FS\']"';

Afterwards FS will be available as member on the exported module and you can reference it via artoolkit.FS - You simply need to replace FS. with artoolkit.FS. and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants