-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ A place for all my cheat sheets to live! | |
|
||
- **[Git](git.md#useful-git-commands)** | ||
|
||
- **[npm](npm.md#npm-plz!)** |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# NPM plz! | ||
|
||
A list of terminal commands and flags to help me use `npm` | ||
|
||
## enable npm cache | ||
|
||
Super charge `npm` | ||
|
||
``` | ||
npm config set cache-min 9999999 | ||
``` | ||
|
||
## install package.json dependencies | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
**Shorthand** | ||
|
||
``` | ||
npm i | ||
``` | ||
|
||
## add standard by feross | ||
|
||
``` | ||
npm install standard -g | ||
``` | ||
|
||
## update npm | ||
|
||
``` | ||
npm install -g npm@latest | ||
``` | ||
|
||
## flags | ||
|
||
`-S` is the same as `--save` | ||
`-D` is the same as `--save-dev` | ||
|
||
## installed version | ||
|
||
`npm list` for local packages or `npm list -g` or `npm list -g --depth=0` for globally installed packages. | ||
|
||
## Node Version Manager `nvm` | ||
|
||
Say you want to install Node v6.9.1 you would write on the terminal: | ||
|
||
``` | ||
nvm install 6 | ||
``` | ||
|
||
If you have multiple versions of Node.js installed on your workspace, you can switch to a specific version by writing: | ||
|
||
``` | ||
nvm use 0.10.40 | ||
``` | ||
|
||
Making a node version default | ||
|
||
In order to set a default version of node for your workspace, just type: | ||
|
||
``` | ||
nvm alias default 6 | ||
``` | ||
|
||
Where 6 was the version you wanted to be used as default. | ||
|
||
## Uninstall global package | ||
|
||
``` | ||
npm -g uninstall <name> --save | ||
``` | ||
|
||
## Upgrade NPM on Windows | ||
|
||
```shell | ||
npm-windows-upgrade | ||
``` | ||
|