"TypeError: Cannot read property 'uint8array' of undefined at Object.JSZip.utils.transformTo" when running with io.js
I was trying out io.js 1.0.1 this morning, and using the jpm package, wanted to create an XPI file (zip file with different extension that contains a Firefox add-on). I received this error:
JPM info Starting jpm xpi on Tenon Check
jszip.js:1291
var result = transform[inputType]outputType;
^
TypeError: Cannot read property 'uint8array' of undefined
at Object.JSZip.utils.transformTo (jszip.js:1291:40)
at Object.Uint8ArrayWriter.append (jszip.js:558:33)
at Object.JSZip.generate (jszip.js:774:20)
at C:\Users\Marco\AppData\Roaming\npm\node_modules\jpm\node_modules\zip-dir
index.js:39:24
at C:\Users\Marco\AppData\Roaming\npm\node_modules\jpm\node_modules\zip-dir
index.js:54:13
at C:\Users\Marco\AppData\Roaming\npm\node_modules\jpm\node_modules\zip-dir
index.js:81:11
at fs.js:313:14
at FSReqWrap.oncomplete (fs.js:76:15)
I also filed a related issue with jpm.
Could you paste the code that triggers this error ?
Sorry, I was just trying to use jpm to build me a Firefox extension. I am not at all familiar with the code that might have led to this error and would have a huge amount of digging. There also seem to be more dependencies involved, and I am a total Node/io.js newbie and don't yet know how to read this stuff. :(
Oh, I though that your own code triggered the issue :) I never used jpm, so I'll need more informations : which command triggered the error ? Can I reproduce it with an fresh addon (from jpm init) ?
Yes, you can just execute jpm init, fill out the fields arbitrarily, and then do jpm xpi
Von meinem iPhone gesendet
Am 14.01.2015 um 19:18 schrieb David Duponchel [email protected]:
Oh, I though that your own code triggered the issue :) I never used jpm, so I'll need more informations : which command triggered the error ? Can I reproduce it with an fresh addon (from jpm init) ?
— Reply to this email directly or view it on GitHub.
Thanks for the information !
I reproduced the issue on windows (no error on linux). The error sometimes disappears without any reason but it looks like a Uint8Array which isn't instanceof Uint8Array, greatly confusing JSZip. It sounds like two Uint8Array from different contexts... which should not happen here ? The fact that zip-dir (the npm module used by jpm) uses an old version of JSZip (2.0.0) and vm.createContext doesn't help.
So, what's the best way forward now?
I opened an issue on the zip-dir repository. I will try to create a small test case to reproduce the error and open an issue on iojs' bug tracker. A definitive fix may takes some time :-) (please note that iojs is currently flagged as unstable)
If you need to use jpm with iojs now, you can replace the files inside C:\Users\Marco\AppData\Roaming\npm\node_modules\jpm\node_modules\zip-dir\jszip with the files inside our lib/ folder. It's not a pretty operation but it should work (until your next npm install -g jpm).