1

EDIT:

The correct question is: How do I get crypto out of the browser?

I am getting the error message: ReferenceError require is not defined

in my firefox debugging window

EDIT: it happens only in firefox and not in chrome or safari

nodecrypto = require('crypto');

What is really grinding my gears is that the application runs flawlessly and the error only occurs, when I am opening my dev tools with CMD+OPT+C (on mac) and then clikcing any link in my application.

When I click the same links regularly in the browser without my dev tools open no error occures.

error message

EDIT: This is how my java script is imported:

Ren Iar
  • 25
  • 7
  • 2
    Crypto cant be used in the browser. node.js execute javascript on the server side, not the browser. – Marc Oct 30 '22 at 09:18
  • What do you mean by: Cannot be used in the browser? Do you mean inside the body tag or inside the script tag or inside the header tag or what? This is how my javascript is structured. – Ren Iar Oct 30 '22 at 20:22
  • move `require` script tag above the `app.js` script – Mechanic Oct 30 '22 at 20:26
  • I tried that but had no success (I guess you mean the require.js in front of the app.js The Question is: How do I get the crypto out of the browser? – Ren Iar Oct 30 '22 at 20:58

1 Answers1

0

I had to reinstall firefox and the error was gone it was not related to my code but to the browser which had a mal function hope this helps someone PS: I recommend firefox nightly instead of firefox developer

Ren Iar
  • 25
  • 7