npm v3.10 - ◾
If you are learning npm then i would suggest to go for yarn, dont waste your time in learning npm
npm install -g npm
# Downgrade to a specific version
npm install -g npm@2
npm --version
# Local
npm install package-name
# Local + make an entry in package.json as dependency
npm install package-name --save
# Install specific version of a package
npm install [email protected]
# Global
npm install -g package-name
# Local
npm uninstall package-name
# Global
npm uninstall package-name -g
# Home page
npm home package_name
# Github repo
npm repo package_name
# Local
npm outdated
# Global
npm outdated -g
# Production only
npm outdated --prod
# Local with tree
npm ls
# Local - only parent
npm ls --depth=0
# Global - only parent
npm ls -g --depth=0
# List production packages only
npm ls --prod
npm prune
# Remove all devDependencies from node_modules
npm prune --production
npm update
npm update package_name
npm dedupe
npm cache ls
npm cache clean -f
💡 Bump version number in package.json and create a git tag automatically
npm version 1.2.3
npm shrinkwrap
# Also include devDependencies
npm shrinkwrap --dev
npm install --only=production
npm install git://github.com/user-name/package-name.git#v0.1.0
# OR
npm install user/repo#v1.0.1
npm install --cache-min 999999 package-name
npm view package_name property_in_json
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
chown -r user_name '~/.npm-global'
npm config set save-prefix ~
npm config set save-exact true
npm config set engine-strict true
npm config set ignore-scripts
npm config set init.author.name your_name
npm config set init.author.email your_email
npm completion >> ~/.bashrc
- Package.json extended docs
- Package.json cheatsheet
- Validate package.json
- npm alternative - yarn