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-packageThe package is resolved and downloaded from pckgs.io and added to your package.json.
Install a Specific Version or Tag
npm install @<YOUR_SCOPE>/my-package@1.2.3npm install @<YOUR_SCOPE>/my-package@nextUpgrade a Package
To move to the latest version allowed by the range in your package.json:
npm update @<YOUR_SCOPE>/my-packageTo jump to the newest published version regardless of the current range:
npm install @<YOUR_SCOPE>/my-package@latestInspect What’s Available
npm view @<YOUR_SCOPE>/my-package versionsnpm dist-tag ls @<YOUR_SCOPE>/my-packageInstalling 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>/" >> .npmrcecho "//npm.pckgs.io/<YOUR_ORG_SLUG>/:_authToken=${PCKGS_TOKEN}" >> .npmrcnpm ciPublic 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 support@pckgs.io.