3

I'm using ttest nodejs module in application. Due to updates to it I tried to use updated version [email protected]. When module start compute data the error appears:

ReferenceError: WebAssembly is not defined

The NodeJS version - 6.9.1.

Error appears in next place:

class CephesWrapper {
  constructor(sync) {
    // Initialize the runtime's memory
    this._wasmMemory = new WebAssembly.Memory({
      'initial': TOTAL_MEMORY / WASM_PAGE_SIZE,
      'maximum': TOTAL_MEMORY / WASM_PAGE_SIZE
    });
.....
  }
}

Is there any advices about solving this issue? Is it possible to define WebAssembly?

6
  • Please, add your code to the question Commented Dec 20, 2018 at 15:24
  • Did you required/imported WebAssembly?. Try this stackoverflow.com/questions/48015777/… Commented Dec 20, 2018 at 15:34
  • No I didn't. I added [email protected]. This module depends on [email protected] module which uses cephes module that calls WebAssembly. Commented Dec 20, 2018 at 15:43
  • Did you use Emscripten? Please add the emcc command you used. You did not mention any information about the toolchain, which is the most important thing to identify the problem. Commented Dec 20, 2018 at 15:44
  • 1
    Oh I thought the error happened in your own code. It is a bit weird that I could not any WebAssembly-related code in ttest. Commented Dec 20, 2018 at 15:58

3 Answers 3

4

The WebAssembly support is added in NodeJs 8.0.0. Update your NodeJS to make it work.

Sign up to request clarification or add additional context in comments.

Comments

1

In my case, the problem was that I was running my browser in safe mode (Mozilla Firefox). Simply shutdown your browser completely and restart. This will quit safe mode (If stuck in safe mode, see here)

For reference, I had found this solution here : https://github.com/mozilla-iot/gateway/issues/2047

3 Comments

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
Hello, Thank you for the advice. Maybe I didn't express myself clearly. As a matter of fact, my first paragraph is indeed the essential part of the answer I found. I provided the link just to emphasize that I didn't come up with it and to provide more context.
didn't think safe mode would have anything to do with this, thanks dude!
0

Even my node version was 12, and npm version was 6. I was getting the reference error for webassembly.

So I updated the node with latest version(16), it changed the npm version also. Now the reference issue is fixed.

D:\ReactJS\react_demo>node -v

v16.14.0

D:\ReactJS\react_demo>npm -v

8.3.1

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.