An open API service indexing awesome lists of open source software.

https://github.com/devmasen/learning-npm

NPM important notes and commands
https://github.com/devmasen/learning-npm

learning nodejs npm

Last synced: 3 months ago
JSON representation

NPM important notes and commands

Awesome Lists containing this project

README

          

Node Package Manager Guide

## Commands :

1. `npm init` : initialize npm for local project by asking questions and create package.json
1. `npm init -y` or `npm init --yes` : initializing npm for local project with difault values and create package.json
1. `npm i []...[--save]` or `npm install []...[--save]`: install dependencies(packages) for project and add them to node_modules and package.json
1. `npm uninstall ` or `npm un ` : uninstall a dependency(package) from project and remove it from node_modules and package.json
1. `npm remove ` or `npm rm ` : remove(uninstall) a package
1. `npm i` : install all required packages for project that specified in package.json (create node_modules)
1. `npm i @.[].[]` : install a specific version of a package.
1. `npm i --save-dev` or `npm i -D` : install a dependency(package) in development phase (project can run without it)
1. `npm i -g` : install a package for project globaly and accesible on all drives(path: 'C:\Users\mhow3\AppData\Roaming\npm\node_modules')
1. `npm uninstall -g` : uninstall a package globaly
1. `npm list` : log all dependencies to last depth
1. `npm list --depth ` : log dependencies in a specific depth (\)
1. `npm [config] set init- "initialValue"` : set a default value for npm package.json properties
1. `npm [config] get init-` : get a property of package.json
1. `npm run ` : run a custom script that wrote in package.json "scripts"
1. `node ` : run a javascript file with node.js
1. `tsc ` : transport a typescript file into javascript file
1. `tsc -w` : transport and watch a typescript file into javascript
1. `npm update` : update packages to the last version toward one of these character before version in package.json (^ : patch and minor , ~ : patch only , * : major and minor and patch)
1. `npx parcel ` : build a webapp with parcel
1. `npm audit` : scan packages for find vulnerabilities of them
1. `npm audit fix` : fix all vulnerabilities in packages

## Notes :
- #### npx(Node Package Execute) : run package that have not been installed on project