@scope/package-name — install and use scoped npm packages
Quick Answer
# Install a scoped package
npm install @scope/package-name
# Examples
npm install @types/node
npm install @vitejs/plugin-react
npm install @company/internal-lib
Usage
Scoped packages group related packages under an organization or user namespace.
Other causes & fixes
Publishing a scoped package
# Publish publicly (scoped packages are private by default!)
npm publish --access public
# Publish privately (requires paid npm account or private registry)
npm publish
Configure a scope to use a private registry
# .npmrc — map @myorg scope to a private registry
@myorg:registry=https://npm.mycompany.com/
# Then install as normal
npm install @myorg/internal-lib
Import in code
// Both CommonJS and ESM work the same
import { helper } from '@scope/package-name';
const { helper } = require('@scope/package-name');
Related