How to Install an npm Package
Install Node.js packages hosted on pckgs.io into your project.
Prerequisites
- Node.js and
npminstalled. - For private packages: authentication configured. See npm Package Registry Authentication.
Map the Scope
pckgs.io packages are always scoped, so the client only needs to know which registry serves that
scope. Add it to your project’s .npmrc:
@<YOUR_SCOPE>:registry=https://npm.pckgs.io/<YOUR_ORG_SLUG>/
#This is needed only if your package is private
//npm.pckgs.io/<YOUR_ORG_SLUG>/:_authToken=<YOUR_ACCESS_TOKEN> Every other package keeps resolving from your default registry, so mixing public npmjs.com dependencies with private pckgs.io ones needs no extra configuration.
Install the Package
npm install @<YOUR_SCOPE>/my-package The package is resolved and downloaded from pckgs.io and added to your package.json.
Install a Specific Version or Tag
npm install @<YOUR_SCOPE>/[email protected]
npm install @<YOUR_SCOPE>/my-package@next Upgrade a Package
To move to the latest version allowed by the range in your package.json:
npm update @<YOUR_SCOPE>/my-package To jump to the newest published version regardless of the current range:
npm install @<YOUR_SCOPE>/my-package@latest Inspect What’s Available
npm view @<YOUR_SCOPE>/my-package versions
npm dist-tag ls @<YOUR_SCOPE>/my-package Installing in CI
npm ci needs the same scope mapping and, for private packages, the token:
echo "@<YOUR_SCOPE>:registry=https://npm.pckgs.io/<YOUR_ORG_SLUG>/" >> .npmrc
echo "//npm.pckgs.io/<YOUR_ORG_SLUG>/:_authToken=${PCKGS_TOKEN}" >> .npmrc
npm ci Public packages need no token at all — the scope mapping alone is enough.
Related
- npm Package Registry
- How to Publish an npm Package
- npm Package Registry Authentication
- How to Import an npm Package
Need help? Contact us here or at [email protected].