Skip to content

Instantly share code, notes, and snippets.

@Sunny-unik
Last active September 18, 2023 17:33
Show Gist options
  • Save Sunny-unik/50219ea81583ddf28148b3ec72b18e5c to your computer and use it in GitHub Desktop.
Save Sunny-unik/50219ea81583ddf28148b3ec72b18e5c to your computer and use it in GitHub Desktop.
Some useful commands of npm
npm --version
- tells the node-package-manager version (shorthand use '-v' instead of 'version')
npm init
- initialize package.json
npm install
- install all node packages that are written as dependencies in packages.json (shorthand use 'i' instead of 'install')
npm install <package-name> <package-name>
- install specified packages (-D and --save-dev for install as dev-dependencies) (-g for install globally)
npm uninstall <package-name>
- uninstall packages
npm update
- update the installed packages to their latest versions. It checks the package's version specified in the package.json file
npm upgrade
- upgrade the installed packages to their latest versions, regardless of the version range specified in the package.json file
sudo npm cache clean -f
- cleans the npm cache
npm login
- for login
npm logout
- for logout
npm publish
- publish node package on npmjs
npm unpublish
- unpublish node package from npmjs
npm link
- publish package locally
npm link <package-name>
- install local package
npm unlink <package-name>
- remove specifed local package
npm whoami
- tells your username
npm create vite@latest
- create project using vite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment