sidebase / nuxt-session

Nuxt session middleware to get a persistent session per app user, e.g., to store data across multiple requests. The nuxt session module provides the useSession() composable out of the box and sets up API endpoints to interact with your session to make working with sessions feel like a breeze.
https://sidebase.io/nuxt-session/
MIT License
189 stars 21 forks source link

Cannot find module 'argon2/lib/binding/napi-v3/argon2.node' #86

Open waltkb opened 1 year ago

waltkb commented 1 year ago

Environment

Reproduction

pnpx nuxi init
pnpm i -D @sidebase/nuxt-session
# add `modules: ['@sidebase/nuxt-session']` to `nuxt.config.ts`
pnpm dev

Describe the bug

The console prints the error below, and when visiting the webpage it returns 503 Server Unavailable and the error below:

ERROR  [worker reload] [worker init] Cannot find module '/home/user/IdeaProjects/nuxt-app/node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/lib/binding/napi-v3/argon2.node'

Require stack:
- /home/user/IdeaProjects/nuxt-app/node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js

  Require stack:
  - node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
  at Module._load (node:internal/modules/cjs/loader:901:27)
  at Module.require (node:internal/modules/cjs/loader:1115:19)
  at require (node:internal/modules/helpers:119:18)
  at Object.<anonymous> (node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js:9:25)
  at Module._compile (node:internal/modules/cjs/loader:1233:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
  at Module.load (node:internal/modules/cjs/loader:1091:32)
  at Module._load (node:internal/modules/cjs/loader:938:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)

This error does not occur when modules: ['@sidebase/nuxt-session'] is removed from nuxt.config.ts.

Additional context

No response

Logs

No response

longstory0 commented 1 year ago

try

Environment

  • Operating System: Linux
  • Node Version: v20.5.0
  • Nuxt Version: 3.6.5
  • Nitro Version: 2.5.2
  • Package Manager: pnpm@8.6.12
  • Builder: vite
  • User Config: devtools, modules
  • Runtime Modules: @sidebase/nuxt-session@0.2.7
  • Build Modules: -

Reproduction

pnpx nuxi init
pnpm i -D @sidebase/nuxt-session
# add `modules: ['@sidebase/nuxt-session']` to `nuxt.config.ts`
pnpm dev

Describe the bug

The console prints the error below, and when visiting the webpage it returns 503 Server Unavailable and the error below:

ERROR  [worker reload] [worker init] Cannot find module '/home/user/IdeaProjects/nuxt-app/node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/lib/binding/napi-v3/argon2.node'

Require stack:
- /home/user/IdeaProjects/nuxt-app/node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js

  Require stack:
  - node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js
  at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
  at Module._load (node:internal/modules/cjs/loader:901:27)
  at Module.require (node:internal/modules/cjs/loader:1115:19)
  at require (node:internal/modules/helpers:119:18)
  at Object.<anonymous> (node_modules/.pnpm/argon2@0.30.3/node_modules/argon2/argon2.js:9:25)
  at Module._compile (node:internal/modules/cjs/loader:1233:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
  at Module.load (node:internal/modules/cjs/loader:1091:32)
  at Module._load (node:internal/modules/cjs/loader:938:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)

This error does not occur when modules: ['@sidebase/nuxt-session'] is removed from nuxt.config.ts.

Additional context

No response

Logs

No response

try changing your package manager... I think is a dependency issue. Make sure to delete the node_modules and the lock files before doing a fresh install. this fixed it for me. I was using bun and switched to pnpm. but error will still be shown unless you delete the lock file and node modules. I hope this works for you.