@node-rs/argon2: Module parse failed: Unexpected character '�'

Đang mở
#847 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
next.js, node.js, rust, typescript

Hướng nghiên cứu

Tái hiện việc import server-action của Next.js 14 bằng các đường dẫn package được hiển thị trong node_modules, sau đó kiểm tra src/lib/auth/index.ts và src/actions/login.ts cùng với binary native Windows được liệt kê. Xác minh rằng development server có thể load import mà không gặp lỗi parse và cả hashPassword lẫn verifyPassword vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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/@[email protected]/node_modules/@node-rs/argon2-win32-x64-msvc/argon2.win32-x64-msvc.node
./node_modules/.pnpm/@[email protected]/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

Ngôn ngữ chính
Rust
Star
1.5k
Fork
52
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của napi-rs/node-rs

Tất cả issue của napi-rs/node-rs

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.