npm, pnpm and Yarn
npm, pnpm and Yarn all talk to Pratique as an npm registry at /npm/. This page shows the settings for each, how lockfiles behave, and what the errors look like.
The examples use https://pratique.example.com. Use your own server's public URL.
Connect clients in the web UI shows these settings for your server, and the token page shows
them with your token filled in. To create a token, see access tokens.
npm
npm needs two lines in .npmrc: the registry address, and the token for that address.
registry=https://pratique.example.com/npm/
//pratique.example.com/npm/:_authToken=YOUR_TOKEN
The second line must start with the same host and path as the registry, without the scheme. npm sends the token only to that address.
Project or user configuration
npm reads .npmrc from your project folder, next to package.json, and from your home
folder. Both work with Pratique.
- In the project: the registry setting travels with the code, so every developer and CI job
uses Pratique. Do not commit a token. npm replaces
${VAR}with an environment variable, so commit the file in this form and setPRATIQUE_TOKENon each machine:
registry=https://pratique.example.com/npm/
//pratique.example.com/npm/:_authToken=${PRATIQUE_TOKEN}
- In your home folder: one setup covers every project on that machine. You can write it with npm itself:
npm config set registry https://pratique.example.com/npm/
npm config set //pratique.example.com/npm/:_authToken YOUR_TOKEN
pnpm
pnpm reads the same .npmrc files as npm, so the settings above work without change.
Yarn
Yarn 1 reads .npmrc too. Yarn 2 and later use .yarnrc.yml instead:
npmRegistryServer: "https://pratique.example.com/npm/"
npmAuthToken: "${PRATIQUE_TOKEN}"
npmAlwaysAuth: true
Yarn refuses plain HTTP registries unless the host is in unsafeHttpWhitelist. For a trial on
http://127.0.0.1:8484, add unsafeHttpWhitelist: ["127.0.0.1"]. Use HTTPS for anything
else. For details of these settings, see the
Yarn configuration reference.
Scoped and internal packages
Scoped packages, such as @types/node, go through Pratique like any other package.
Internal names that match a reserved pattern, such as @acme/*, are never looked up on the public
registry. That stops dependency confusion: nobody can publish @acme/billing on npmjs.com and have
your clients install it.
- In artifactory mode, Pratique hosts your private packages under those names, so the same
registryline covers them. - A reserved name with nothing published returns HTTP 404, with the message "is a reserved internal name with nothing published, and it's never fetched upstream".
- In firewall mode, Pratique hosts no private packages. Point the scope at your own registry
with a line such as
@acme:registry=https://npm.internal.example.com/.
Held and refused versions
Pratique marks each version that a client cannot download as deprecated, with a message that gives the
reason. npm chooses a deprecated version only when no other version fits. The latest tag also
points at the newest cleared version. So a plain npm install some-package gets the newest cleared
version and does not fail.
If you ask for a held or refused version by number, or a lockfile pins one, the download is refused with HTTP 403. npm prints the reason after the URL, in a line like this:
403 Forbidden - GET https://pratique.example.com/npm/some-package/-/some-package-4.3.0.tgz - pratique: held some-package@4.3.0: in quarantine until 2026-12-08 09:15 UTC. To see why, or request an exception, open https://pratique.example.com/packages/npm/some-package?version=4.3.0#why
A refused version gives its reason in the same place, for example "blocked by the install scripts rule" or "known malware". If no version of a package is cleared, the listing itself is refused, with "no version of some-package is cleared" and the reason for the newest one.
Open the link to see each check on the package page, and to request an exception. The decision for each version is described in how it works.
Missing or wrong token
Without a valid token, Pratique answers HTTP 401. npm never prints the body of a 401, so Pratique also sends
the message in an npm-notice header, which npm prints with its own error:
npm notice pratique: a valid client token is required. Create one at https://pratique.example.com/tokens, and set up your package manager as https://pratique.example.com/connect shows
A wrong or expired token gets the same answer, even on a server that lets local clients connect without a
token. Check that the _authToken line has the same host and path as the registry. A token for an AI
triage agent cannot download packages. It gets HTTP 403, "an AI triage token can only be used at /mcp".
Lockfiles
package-lock.json records a resolved URL for each package. With Pratique as the
registry, those URLs point at Pratique:
"resolved": "https://pratique.example.com/npm/lodash/-/lodash-4.17.21.tgz"
An older lockfile that points at registry.npmjs.org still downloads through Pratique with
current npm, because npm replaces that host with your configured registry by default. Other hosts, Git URLs
and tarball URLs are not replaced. Each download is checked again on Pratique, so a lockfile cannot pin its way
past quarantine or a block.
To make sure no lockfile fetches from anywhere else, run pratique lockcheck in CI. It fails
when a lockfile names any other source, including registry.npmjs.org, Git dependencies and direct
URLs. It reads package-lock.json, npm-shrinkwrap.json, yarn.lock and
pnpm-lock.yaml, among others.
pratique lockcheck --registry https://pratique.example.com
If it fails, regenerate the lockfile with Pratique as the registry. See CI.
What else works
npm auditworks through Pratique.npm searchand npm's other service endpoints are not offered.- Remote dependencies, on a URL or a Git repository, are blocked by default, because npm fetches them directly and skips every check. See risk rules.
Publish private packages
In artifactory mode, you can publish packages under a reserved name with npm publish. The token
needs publish access, which only an admin can grant.
npm publish --registry=https://pratique.example.com/npm/
See private packages.