🔑 npm-token.prusa3d.dev
Internal

NPM Token Setup

Configure access to @prusa3d-platform private packages.
One command to set up your local development environment.

Quick Setup

Run this command to configure your local environment:

curl -fsSL https://npm-token.prusa3d.dev/setup | bash
irm https://npm-token.prusa3d.dev/setup.ps1 | iex

Creates a new token, or validates existing one. If token is expired or invalid, prompts to create a new one.

Not on VPN? See setup without VPN.

Revoke Token

To revoke your token and remove local configuration:

curl -fsSL https://npm-token.prusa3d.dev/revoke | bash
irm https://npm-token.prusa3d.dev/revoke.ps1 | iex

Revokes the token via GitLab API and removes the local token file.

What it does

🔑
Creates GitLab PAT
Opens GitLab with pre-filled token settings (api scope, 30 days expiry)
💾
Stores securely
Linux/macOS: ~/.config/prusa/npm-token (chmod 600)
Windows: %LOCALAPPDATA%\Prusa\npm-token (restricted ACL)
⚙️
Configures shell
Linux/macOS: Adds export to .zshrc / .bashrc
Windows: Sets persistent User environment variable
✅
Validates token
Checks if existing token is valid, expired, or needs renewal

Manual Setup

If you prefer to set things up manually:

  1. Create a GitLab Personal Access Token with api scope
  2. Add the token to your environment:

    Add to ~/.zshrc or ~/.bashrc:

    export NPM_PRUSA_PLATFORM_TOKEN="glpat-your-token-here"

    Run in PowerShell:

    [Environment]::SetEnvironmentVariable("NPM_PRUSA_PLATFORM_TOKEN", "glpat-your-token-here", "User")

    Or: Settings → System → About → Advanced system settings → Environment Variables

  3. Create .npmrc in your project:
    @prusa3d-platform:registry=https://gitlab.com/api/v4/packages/npm/
    //gitlab.com/api/v4/packages/npm/:_authToken="${NPM_PRUSA_PLATFORM_TOKEN}"
    @prusa3d-platform:registry=https://gitlab.com/api/v4/packages/npm/
    //gitlab.com/api/v4/packages/npm/:_authToken=${NPM_PRUSA_PLATFORM_TOKEN}

    Note: On Windows, use ${VAR} without quotes.

Troubleshooting

Setup command fails when not on VPN

Off VPN, the scripts are behind Cloudflare Access and plain curl / irm gets a login page instead of the script. Use cloudflared to log in first, then download the script through it:

# 1. Install cloudflared (once)
brew install cloudflared

# 2. Log in (opens browser)
cloudflared access login https://npm-token.prusa3d.dev

# 3. Run setup
cloudflared access curl https://npm-token.prusa3d.dev/setup | bash
# 1. Install cloudflared (once)
winget install --id Cloudflare.cloudflared

# 2. Log in (opens browser)
cloudflared access login https://npm-token.prusa3d.dev

# 3. Run setup
cloudflared access curl https://npm-token.prusa3d.dev/setup.ps1 | Out-String | iex

The same works for revoke: replace /setup with /revoke. On Linux, install cloudflared from Cloudflare downloads.

npm install fails with E401

Your token is invalid or expired. Run the setup command again:

curl -fsSL https://npm-token.prusa3d.dev/setup | bash
irm https://npm-token.prusa3d.dev/setup.ps1 | iex
Token not found after setup

The token is loaded when you start a new shell. Either:

  • Open a new terminal
  • Or run: source ~/.zshrc

Environment variables require a new terminal session. Either:

  • Open a new PowerShell / Terminal window
  • Or refresh variables in current session
Permission denied on token file

Fix permissions:

chmod 600 ~/.config/prusa/npm-token
chmod 700 ~/.config/prusa

Reset file permissions (PowerShell as Administrator):

$path = "$env:LOCALAPPDATA\Prusa\npm-token"
icacls $path /reset
icacls $path /inheritance:r /grant:r "$($env:USERNAME):(R,W)"
PowerShell execution policy error (Windows)

If you see "running scripts is disabled on this system", run PowerShell as Administrator:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Then try the setup command again.

Download and run scripts manually (Windows)

If you're having issues with the remote execution, you can download the scripts and run them locally:

  1. Download the scripts:
    • setup.ps1 from https://npm-token.prusa3d.dev/setup.ps1
    • revoke.ps1 from https://npm-token.prusa3d.dev/revoke.ps1
  2. Unblock the downloaded file(s):
    Unblock-File .\setup.ps1
    Unblock-File .\revoke.ps1
  3. Execute the script:
    .\setup.ps1

    Or for revoke:

    .\revoke.ps1