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
- Host: GitHub
- URL: https://github.com/devmasen/learning-npm
- Owner: DevMasen
- Created: 2024-09-07T17:17:52.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T18:43:49.000Z (almost 2 years ago)
- Last Synced: 2025-01-29T15:12:33.303Z (over 1 year ago)
- Topics: learning, nodejs, npm
- Language: HTML
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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