tonyg/js-nacl

Does not work in browser

limenleap opened this issue · 1 comments

I was happy to read this line in the README

"Essentially, the source checkout contains everything you will need to use the library in both the browser and in node.js."

So I uploaded the entire checkout into a webserver and loaded runner.html from the test folder

Sadly, it gives these errors. I am a newbie at cryptography

runner.html:1 Refused to apply style from 'https://abcxyz.com/nacl/node_modules/mocha/mocha.css' because its MIME type ('text/plain') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
runner.html:11 GET https://abcxyz.com/nacl/node_modules/mocha/mocha.js net::ERR_ABORTED 404
runner.html:1 Refused to execute script from 'https://abcxyz.com/nacl/node_modules/mocha/mocha.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
runner.html:12 Uncaught TypeError: mocha.setup is not a function
    at runner.html:12
(anonymous) @ runner.html:12
runner.html:39 Uncaught TypeError: Cannot read property 'emit' of undefined
    at nacl_factory.instantiate.memoryInitializerPrefixURL (runner.html:39)
    at nacl_factory.js:577
    at Object.instantiate (nacl_factory.js:581)
    at runner.html:37
tonyg commented

Run npm install . in the checkout root directory (the one with package.json) first. This will download and install the test library, mocha. Then reload the page.