Packer CLI
raw JSON → 2.17.8 verified Fri May 01 auth: no javascript
Full-featured CLI tool for scaffolding and packaging Node library modules compliant with both Node.js and browsers. At version 2.17.8, it integrates Rollup for bundling, Gulp for task automation, Babel for transpilation, and supports multiple test frameworks (Mocha, Jest, Jasmine, Karma) and style preprocessors (PostCSS, LESS, SASS, Stylus). Differentiates itself by enforcing best practices and providing a unified workflow for file-watching, live-reloading, transpilation, bundling, and unit testing with coverage. Ships TypeScript types, supports React, Handlebars, and JSdom. Release cadence appears irregular; no major releases recently.
Common errors
error Error: Cannot find module 'packer-cli' ↓
cause Missing local installation; global install may not resolve.
fix
Install locally: npm install --save-dev packer-cli, then use npx packer
error ERR_PNPM_LOCKFILE_COPY_FAILED ↓
cause Packer CLI generates a package-lock.json but may not be compatible with pnpm.
fix
Use npm instead of pnpm for Packer CLI managed projects.
error TypeError: Cannot read property 'tasks' of undefined ↓
cause Custom Gulpfile may not be present or incorrectly configured.
fix
Ensure a valid gulpfile.js exists in the project root.
Warnings
gotcha The package relies heavily on Gulp and Rollup. If you already have a custom build setup, integrating Packer CLI may cause conflicts. ↓
fix Use Packer CLI only for greenfield projects or ensure your existing build tools do not interfere.
gotcha Packer CLI may generate projects with deprecated TSLint instead of ESLint for TypeScript linting. TSLint is deprecated in favor of ESLint with typescript-eslint. ↓
fix After scaffolding, replace TSLint with ESLint using the @typescript-eslint parser.
gotcha Live-reloading may fail on Windows systems due to path separator issues in Gulp watch tasks. ↓
fix Use Unix-like environment (WSL) or ensure your project paths use forward slashes.
Install
npm install packer-cli yarn add packer-cli pnpm add packer-cli Imports
- packer wrong
const packer = require('packer-cli')correctimport packer from 'packer-cli' - PackerConfig wrong
import { PackerConfig } from 'packer-cli/lib/config'correctimport { PackerConfig } from 'packer-cli' - createProject wrong
import createProject from 'packer-cli/src/createProject'correctimport { createProject } from 'packer-cli'
Quickstart
import { createProject } from 'packer-cli';
async function scaffold() {
await createProject({
name: 'my-lib',
template: 'default',
transpiler: 'babel',
test: 'jest',
css: 'sass',
react: false
});
console.log('Project scaffolded.');
}
scaffold().catch(console.error);