Resolving Argon2 "No native build found" Error in Production

2024. 8. 21. 00:36· Trouble Shooting
목차
  1. Resolving Argon2 "No native build found" Error in Production
  2. The Solution: Build from Source

Resolving Argon2 "No native build found" Error in Production

 

Image illustration by Dalle3

 

 

When deploying Node.js applications that use the argon2 package for password hashing, you might encounter this error:

 ⨯ Error: No native build was found for platform=linux arch=x64 runtime=node abi=127 uv=1 libc=glibc node=22.6.0
    loaded from: /app/node_modules/argon2

    at load.resolve.load.path (/app/node_modules/node-gyp-build/node-gyp-build.js:60:9)
    at load (/app/node_modules/node-gyp-build/node-gyp-build.js:22:30)
    at Object.<anonymous> (/app/node_modules/argon2/argon2.cjs:7:32)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)

 

This occurs because the pre-built binary for argon2 is incompatible with your Docker environment. Here's how to fix it:

 


 

 

The Solution: Build from Source

 

Modify your Dockerfile to build argon2 from source during the image creation process. Here's an example:

FROM node:22-slim AS base

# Install build essentials
RUN apt-get update && apt-get install -y python3 make g++
FROM base AS deps
WORKDIR /app

# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci

# Rebuild argon2
RUN npm rebuild argon2 --build-from-source

# ... rest of your Dockerfile

 

저작자표시 (새창열림)
  1. Resolving Argon2 "No native build found" Error in Production
  2. The Solution: Build from Source
'Trouble Shooting' 카테고리의 다른 글
  • 스프링 - Google OAuth2 로그인 redirect_uri_mismatch
  • Cloudflare - R2 Bucket CORS 에러 해결하기
  • NextJS - ReferenceError: File is not defined 해결하기
  • GithubActions - ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator... 해결하기
gerrymandering
gerrymandering
gerrymandering
gerrymandering
gerrymandering
전체
오늘
어제
  • 분류 전체보기 (77)
    • SOLID 원칙 (6)
    • 번역 (4)
    • Nginx (1)
    • Tailwind CSS (1)
    • AWS (7)
      • DMS를 사용한 RDS to OpenSearch .. (3)
      • ECS를 이용한 Blue-Green 무중단 배포 .. (7)
    • NextJS (3)
    • 기타 (10)
    • Prompt Engineering (6)
    • 읽어볼만한 글 (3)
      • 기술 (0)
      • 쓸만한 툴 (0)
      • 아이템 (0)
      • 웹 디자인 (0)
      • 기타 (3)
    • Cloud Architecture (4)
    • Trouble Shooting (9)
    • Spring (11)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

최근 댓글

최근 글

글쓰기 / 관리자
hELLO · Designed By 정상우.v4.2.1
gerrymandering
Resolving Argon2 "No native build found" Error in Production
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.