You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Latest npm installing
npm install npm@latest
# if you installfrom other resource Like git, tarball
npm install loadsh@latest
npm install <tarball file>
npm install <tarball url>
npm install <git remote url>
npm install gist:<gist-id>
# npm install local
npm install <package-name>
npm i <package-name>
# npm install local and make an entry in package.json
npm install <package-name> --save
# npm install globally syntax
npm install --g <package-name>
npm i -g <package-name>
# If you want to install a specific version of a package use:
npm install <package-name>@<version>
# install a version which matches "version >= 4.10.1" and "version < 4.11.1"
npm install loadsh@”>= 4.10.1 <4.11.1”
# packages available on GitHub
npm install <username>/<repository>
# npm install dependencies
npm install –save <name>
npm install –S <name>
npm i –S < name>
# Install dependencies for development purposes
$ npm install –save-dev <package-name>
NPM UNINSTALL
npm uninstall <package-name>
npm remove <package-name>
npm rm <package-name>
npm r <package-name>
npm unlink <package-name>
npm un <package-name>
# Global Package Uninstall
npm uninstall -g <package-name>
# if you would like to remove the package from package.json as part of uninstallation
npm uninstall --save <package-name>
npm uninstall –S <package-name>
# For a development dependency, use the --save-dev flag (shorthand: -D):
npm uninstall –save-dev <package-name>
npm uninstall –S <package-name>
NPM INIT
# If you want ask for configuration then use:
npm init
# Default configuration in package.json
npm init –yes
npm init –y
4. Packages List
npm list
npm list --json
npm list --dev
npm list --development
npm list --prod
npm list --production
npm list --global
json - Shows information in json format
long - Shows extended information
parseable - Shows parseable list instead of tree
global - Shows globally installed packages
depth - Maximum display depth of dependency tree
dev/development - Shows devDependencies
prod/production - Shows dependencies
NPM UPDATE
# update all packages
npm update
# update a specific package:
npm update <package-name>
# In case you also want to lock the updated version in package.json:
npm update <package-name> --save
NPM cache
# cache list
npm cache ls
# cache clean
npm cache clean -f