@node-rs/argon2: Module parse failed: Unexpected character '�'
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 52
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 19
Description
The Problem
After installing this package using pnpm add @node-rs/argon2 my dev server crashes immediately with the following error:
Module parse failed: Unexpected character '�' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
Import trace for requested module:
./node_modules/.pnpm/@node-rs+argon2-win32-x64-msvc@1.8.3/node_modules/@node-rs/argon2-win32-x64-msvc/argon2.win32-x64-msvc.node
./node_modules/.pnpm/@node-rs+argon2@1.8.3/node_modules/@node-rs/argon2/index.js
./src/lib/auth/index.ts
./src/actions/login.ts
The character in question is: "U+FFFD".
I am using a Next.js 14 with server actions, where I use @node-rs/argon2 for hashing and verifying passwords on the server.
There is only two functions where I use @node-rs/argon2:
import { hash, verify } from "@node-rs/argon2"
export async function hashPassword(password: string) {
const hashedPassword = await hash(password, {
memoryCost: 19456,
parallelism: 1,
timeCost: 2,
})
return hashedPassword
}
export async function verifyPassword(password: string, hashedPassword: string) {
const isValid = await verify(hashedPassword, password)
return isValid
}
Node Version
This might be the problem since it is not listed in the support matrix.
v20.12.0
Operating System
Windows 10 x64
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Next.js 14 server-action import using the package paths shown in node_modules, then inspect src/lib/auth/index.ts and src/actions/login.ts alongside the listed Windows native binary. Verify the development server can load the import without the parse failure and that both hashPassword and verifyPassword still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, node.js, rust, typescript
- Domain
- authentication, backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100