node-argon2 icon indicating copy to clipboard operation
node-argon2 copied to clipboard

ReferenceError: require is not defined

Open pulgueta opened this issue 1 year ago • 1 comments

Welcome to the issues section if it's your first time!

Before creating an issue, please be sure to:

  • [x] Checkout to the latest version, including submodules
  • [x] Try to find an isolated way to reproduce the behavior
  • [x] Fill in all the blanks in the most specific way you can

Steps to reproduce

I am using Next.js, I had a project using argon2 which worked just fine, but now in a new project I try to use argon2 but fails. No edge pages or route handlers are set.

  1. Install argon2 with bun add argon2
  2. Run local development server bun dev
  3. Fails

Expected behaviour

It should let the page load even if the function running the package is not being used and hash the password.

Actual behaviour

Page loads, shows a 200 OK status in console but throws this error: image

Environment

Operating system:

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16304
  Available CPU cores: 6
Binaries:
  Node: 20.12.2
  npm: N/A
  Yarn: N/A
  pnpm: 9.0.1
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: 14.2.3
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

Node version: 20.11.0

Bun version: 1.1.7

Compiler version:

pulgueta avatar May 09 '24 03:05 pulgueta

From the stack trace I suppose that somehow you have a call to argon2 in your frontend, rather than in your backend, which does not work. Is that the case?

ranisalt avatar May 21 '24 16:05 ranisalt