#! /bin/bash
# Installs/Downloads a package in the current folder
npm install # -or- npm i
npm install <pkg>
npm install <pkg>@<tag>
npm install <pkg>@<version>
npm install <folder>
npm install <tarball file>
npm install <git:// url>
npm install gulp-cli -g # -or- --global (installs globally for all)
# Node Package Manager
npm
# has global and local dependency directories (default is local) = node_modules in current directory of project
# create new project (package.json)
npm init (—y)
# install dependency (and list in package.json)
npm i(nstall) x (—save-dev / -D)
npm i x@1.2.3 # specific version
# dependencies = necessary for the project to run
# devDependencies = nec. for developing the project
# list dependencies
npm list (—depth=0)
npm outdated
# package-lock.json = ensure all (sub-)dependencies stay the same for every machine
npm update x ## updates to highest available minor version!
npm run $script (-s) # run script of package.json; -s silent
npm run <command> [-- <args>]
# Link local modules
npm link ../path/to/module # package.json:name = "@scoped/pkg"
require('@scoped/pkg');