Getting `Error: Cannot find module '@node-rs/argon2-linux-arm64-gnu'` and `'./argon2.linux-arm64-gnu.node'` error
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
调研方向
从 node_modules/@node-rs/argon2/index.js 中的原生加载逻辑,以及堆栈跟踪中显示的已部署 .next/server/app/(main)/(auth)/signin/page.js 入口开始。使用列出的 Node.js、Next.js、Docker 和 AWS 部署配置复现该故障;当已部署的哈希和验证 API 能够加载所需的 Linux ARM64 原生绑定且不出现 MODULE_NOT_FOUND 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Here are some of the dependencies I use.
- Next.js:
^14.2.4, - @node-rs/argon2:
^1.8.3 - node:
18.17.1and20.12.2(tried both) - macOS M2 Pro, Sonoma 14.2.1
Build / deploy using both AWS Cloudfront or Docker container
I switched over to using node-rs/argon2 package since the oslo/password package was causing dev error.
If I use node-rs/argon2 package:
import { hash, verify } from '@node-rs/argon2'
...
export async function encryptPassword(password: string): Promise<string> {
return await hash(password, {
memoryCost: 19456,
timeCost: 2,
outputLen: 32,
parallelism: 1,
})
}
export async function verifyPassword(
password: string,
hashedPassword: string,
): Promise<boolean> {
return await verify(hashedPassword, password, {
memoryCost: 19456,
timeCost: 2,
outputLen: 32,
parallelism: 1,
})
}
Error
After building Next.js and deploying it either using AWS Cloudfront or just containerize the app with Docker and running it, the api the handles the hashing and verifying fails with the following error:
Error: Failed to load native binding
at Object.<anonymous> (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:359:11)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at mod.require (/var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
at 82406 (/var/task/.next/server/app/(main)/(auth)/signin/page.js:1:81)
at t (/var/task/.next/server/webpack-runtime.js:1:128) {
digest: '903678548',
[cause]: [
Error: Cannot find module './argon2.linux-arm64-gnu.node'
Require stack:
- /var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js
- /var/task/.next/server/app/(main)/(auth)/signin/page.js
- /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require.js
- /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
at /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:55:36
at Module._load (node:internal/modules/cjs/loader:981:27)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at mod.require (/var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
at requireNative (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:237:16)
at Object.<anonymous> (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:332:17)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
},
Error: Cannot find module '@node-rs/argon2-linux-arm64-gnu'
Require stack:
- /var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js
- /var/task/.next/server/app/(main)/(auth)/signin/page.js
- /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require.js
- /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
at /var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:55:36
at Module._load (node:internal/modules/cjs/loader:981:27)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at mod.require (/var/task/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:65:28)
at require (node:internal/modules/helpers:177:18)
at requireNative (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:242:16)
at Object.<anonymous> (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@node-rs/argon2/index.js:332:17)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [Array]
}
]
}
Can't figure out why this is. Has there been any hacks or fixes for this issue?
- 主要语言
- Rust
- 星标
- 1.5k
- 派生
- 52
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 14
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
napi-rs/node-rs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
napi-rs/node-rs#1009 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 45/100
维护者通常 1 天内回复
-
[node-rs/jieba, lunr.zh error] top-level await is not available in the configured target environment未关闭
难度 4/5 3-5 天 新手友好度 25/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
[Bug]: opencode_go chat route drops reasoning_effort (even 'none'), while the same endpoint honors it via custom_llm_provider=openai可能已有人在做 @arvindkumar-ship-it 今天认领。 未关闭llm translation
难度 2/5 1-3 小时 新手友好度 70/100
BerriAI/litellm#51871 · 1 条评论 ·
维护者通常 1 天内回复
-
comp-formats
难度 2/5 半天 新手友好度 64/100
ClickHouse/ClickHouse#131694 ·
维护者通常 1 天内回复
-
cli: `execCargoMetadata` decodes stdout per chunk, corrupting non-ASCII paths across pipe boundaries未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
C-Bug S-Needs-Triage
难度 2/5 1-3 小时 新手友好度 72/100
bevyengine/bevy#26558 ·
维护者通常 2 天内回复