0

I have a app.js file that requires express as a constant: const express = require('express'); Im getting the error: p.js:1 Uncaught ReferenceError: require is not defined at app.js:1:17 after running my server by typing node app.js.

I am a beginner with node js. To my knowledge, I understand that there is server side and client side, and I am trying to require on the server side since im running Node.js. However the browser doesn't have support for require and is giving me the error, even though Im running the require server side.

  • 2
    Does this answer your question? [Javascript require() function giving ReferenceError: require is not defined](https://stackoverflow.com/questions/23603514/javascript-require-function-giving-referenceerror-require-is-not-defined) – the.marolie Apr 14 '23 at 18:02
  • For some backgroud information see [MDN - JavaScript Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). – Mushroomator Apr 14 '23 at 18:06
  • Hi, what are you requiring from client side? – pierpy Apr 14 '23 at 18:13

0 Answers0