Last active
October 30, 2017 15:14
-
-
Save shafiqsaaidin/d0c1e012ea75d4306fddaedfc108d2a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Title : Npm Crash Course | |
Author : Musha | |
Date : 14/10/2017 | |
Youtube : https://youtu.be/jHDhaSSKmB0 | |
## Check version | |
npm -v / npm --version | |
## make the package.json | |
npm init / npm init -y | |
## set default init to custom | |
npm config set init-author-name "Musha" | |
or | |
npm set init-license "MIT" | |
## check the default init value | |
npm get init-author-name | |
npm get init-license | |
## delete npm custom default value | |
npm config delete init-author-name | |
npm config delete init-license | |
## install packages | |
npm install <package name> --save | |
*note: --save mean it will save the dependencies to package.json | |
npm install <package name> --save-dev | |
## install previous package version | |
npm install <package name>@x.x.x --save | |
npm install [email protected] --save | |
## install regular package from package.json (exclude devdependencies) | |
npm install --production | |
## install package globally | |
npm root -g | |
*note: check root directory for global package | |
npm install -g <package name> | |
## remove packages | |
npm uninstall <package name> --save / --save-dev | |
npm remove -g .. #for global package | |
npm remove .. | |
npm rm / un .. | |
## update package | |
npm update <package name> | |
## list package | |
npm list | |
npm list --depth 0 #list only top lavel | |
## SCRIPT | |
"scripts": { | |
"start": "node index.js", | |
"dev": "live-server" | |
}, | |
run the script | |
--------------- | |
npm start #it will run the command node index.js | |
npm run dev #it will run the live-server(use run if not we not using "start") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment