Skip to main content
For the complete documentation index, see llms.txt

Fix package repository access failures

Midnight 패키지 설치 시 발생하는 403 Forbidden 에러를 해결합니다.

Understand the cause of the error

Midnight 패키지를 설치할 때 403 Forbidden 에러가 발생할 수 있습니다. npm 설정이 잘못된 레지스트리를 가리키고 있거나, 네트워크 제한으로 접근이 차단된 경우에 주로 나타납니다:

npm install @midnight-ntwrk/compact-runtime

npm ERR! code E403
npm ERR! 403 Forbidden - GET https://registry.npmjs.org/@midnight-ntwrk/compact-runtime
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy

아래 해결 방법을 가장 간단한 것부터 순서대로 시도하세요.

Solution 1: Reset npm registry

가장 흔한 원인은 npm 설정이 잘못된 레지스트리를 가리키는 것입니다. npm 레지스트리를 기본 public 레지스트리로 재설정하면 해결됩니다.

1

Check current registry

현재 npm이 사용 중인 레지스트리를 확인합니다:

npm config get registry

출력이 https://registry.npmjs.org/와 다르면 레지스트리 설정이 잘못된 것이므로 재설정이 필요합니다.

2

Reset to default registry

npm 레지스트리를 기본 public 레지스트리로 재설정하고, scoped 레지스트리 설정을 제거한 뒤 npm 캐시를 정리합니다:

npm config set registry https://registry.npmjs.org/
npm config delete @midnight-ntwrk:registry
npm cache clean --force
3

Test installation

npm install @midnight-ntwrk/compact-runtime

확인: 에러 없이 패키지가 정상 설치되면 성공입니다.

Solution 2: Fix VPN and proxy issues

레지스트리 재설정으로 해결되지 않으면 VPN 연결이나 기업 프록시 서버가 npm 접근을 차단하고 있을 수 있습니다. 네트워크 환경에 맞게 npm을 설정하세요.

1

Disable VPN temporarily

기업 네트워크

기업 네트워크에서는 VPN 연결 해제가 허용되지 않을 수 있습니다.

VPN을 해제하고 테스트합니다:

npm install @midnight-ntwrk/compact-runtime

설치에 성공하면 VPN 제한이 원인입니다. 이 경우 프록시 설정으로 우회하세요.

2

Configure proxy (if VPN is required)

VPN 연결을 유지해야 하는 경우, npm에 기업 프록시 서버를 설정합니다. proxy.company.com:8080 부분을 실제 프록시 주소로 바꾸세요:

# 프록시 설정
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

# 인증이 필요한 경우
npm config set proxy http://username:password@proxy.company.com:8080
npm config set https-proxy http://username:password@proxy.company.com:8080
3

Test installation

npm install @midnight-ntwrk/compact-runtime

확인: 프록시를 통해 패키지가 정상 설치되면 성공입니다.

Solution 3: Clear configuration and start fresh

위의 방법으로 해결되지 않으면 npm 설정 간 충돌이 원인일 수 있습니다. 모든 npm 설정을 초기화하여 잘못된 설정을 제거합니다.

1

Back up and clear configuration

중요

이 과정에서 모든 커스텀 설정이 제거되므로, 실행 전에 npm 설정을 백업하세요.

# 기존 설정 백업
cp ~/.npmrc ~/.npmrc.backup

# 모든 설정 제거
npm config delete registry
npm config delete proxy
npm config delete https-proxy
npm config delete @midnight-ntwrk:registry
2

Set defaults and clean project

데이터 손실 주의

아래 명령어는 node_modules와 package-lock.json을 삭제합니다. 실행 전에 올바른 프로젝트 디렉토리에 있는지 확인하세요.

# 레지스트리 설정
npm config set registry https://registry.npmjs.org/

# 프로젝트 정리
rm -rf node_modules package-lock.json
npm cache clean --force
3

Test installation

npm install @midnight-ntwrk/compact-runtime

확인: 패키지가 정상 설치되면 성공입니다.

Platform-specific fixes

특정 OS나 환경에서만 발생하는 npm 접근 문제가 있습니다. 위의 일반적인 방법으로 해결되지 않으면 아래의 플랫폼별 해결 방법을 시도하세요.

Windows Subsystem for Linux(WSL)에서는 줄바꿈 형식 차이와 Windows-WSL 간 캐시 충돌이 npm 에러를 일으킬 수 있습니다:

# git 줄바꿈 설정
git config --global core.autocrlf false

# 네이티브 WSL 경로 사용 (/mnt/c/... 말고)
cd /home/yourusername/project

# Windows npm 캐시 삭제
rm -rf /mnt/c/Users/YourName/AppData/Roaming/npm-cache

yourusernameYourName을 실제 사용자명으로 바꾸세요.

Quick fix script

여러 수정 사항을 한번에 적용하는 자동화 스크립트입니다. npm 설정 초기화, 캐시 정리, 설치 테스트를 순서대로 실행합니다:

fix-midnight-npm.sh
#!/bin/bash

echo "🔧 Fixing Midnight npm installation..."

# Clear configuration
npm config delete registry
npm config delete @midnight-ntwrk:registry
npm config delete proxy
npm config delete https-proxy

# Set defaults
npm config set registry https://registry.npmjs.org/
npm cache clean --force

# Clean project (only if package.json exists)
if [ -f "package.json" ]; then
echo "📁 Cleaning project files..."
rm -rf node_modules package-lock.json
else
echo "⚠️ No package.json found - skipping project cleanup"
fi

# Test installation
echo "🧪 Testing package installation..."
npm install @midnight-ntwrk/compact-runtime

if [ $? -eq 0 ]; then
echo "✅ Success! Midnight packages are accessible."
else
echo "❌ Installation failed. Try disconnecting from VPN or checking firewall settings."
fi

스크립트에 실행 권한을 부여하고 실행합니다:

chmod +x fix-midnight-npm.sh
./fix-midnight-npm.sh

Verify the fix

수정 후 모든 설정이 올바르고 설치가 정상 작동하는지 확인합니다:

# 레지스트리 확인
npm config get registry
# 예상 출력: https://registry.npmjs.org/

# 패키지 접근 테스트
npm view @midnight-ntwrk/compact-runtime
# 예상 출력: 패키지 정보

# 설치 확인
npm install @midnight-ntwrk/compact-runtime
# 예상 결과: 정상 설치

Still not working?

위의 모든 방법으로도 해결되지 않으면, 아래의 고급 디버깅 방법으로 근본 원인을 찾으세요.

Enable verbose logging

verbose 플래그로 npm을 실행하여 상세 에러 정보를 확인합니다:

npm install @midnight-ntwrk/compact-runtime --verbose

verbose 로그에서 흔히 발견되는 문제:

  • SSL 인증서 검증 실패
  • 프록시 설정 에러 또는 인증 문제
  • 레지스트리 접속 시 DNS 해석 실패
Test direct connection

레지스트리 접근 가능 여부를 직접 확인합니다:

curl https://registry.npmjs.org/@midnight-ntwrk/compact-runtime

요청이 실패하면 네트워크 연결 문제입니다.

Next steps

Midnight 패키지를 정상 설치한 후, 개발 환경이 올바르게 구성되었는지 확인합니다:

# 설치된 패키지 확인
npm list @midnight-ntwrk

# 컴파일러 확인
compact --version

# 런타임 import 테스트
node -e "const runtime = require('@midnight-ntwrk/compact-runtime'); console.log('✅ Runtime loaded');"