You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
895 B
64 lines
895 B
3 years ago
|
# Node Package Manager (NPM) quick cheatsheet
|
||
|
|
||
|
## get help
|
||
|
```
|
||
|
npm -h
|
||
|
```
|
||
|
## get help on a command
|
||
|
```
|
||
|
$ npm <command> -h
|
||
|
```
|
||
|
eg :
|
||
|
```
|
||
|
$ npm init -h
|
||
|
```
|
||
|
|
||
|
## init a project (create package.json)
|
||
|
```
|
||
|
$ npm init
|
||
|
```
|
||
|
|
||
|
## install module globally (adds to package.json)
|
||
|
```
|
||
|
npm i -g saxon-js
|
||
|
```
|
||
|
or long version
|
||
|
```
|
||
|
npm install -g saxon-js
|
||
|
```
|
||
|
|
||
|
|
||
|
## install module localy (adds to package.json)
|
||
|
```
|
||
|
npm i saxon-js
|
||
|
```
|
||
|
|
||
|
## install module localy and do not add to package json
|
||
|
```
|
||
|
npm i --no-save saxon-js
|
||
|
```
|
||
|
|
||
|
## check all modules installed localy
|
||
|
```
|
||
|
$ npm ls
|
||
|
```
|
||
|
|
||
|
## check all modules installed globaly
|
||
|
```
|
||
|
$ npm ls -g
|
||
|
```
|
||
|
|
||
|
## uninstall local module
|
||
|
```
|
||
|
npm uninstall saxon-js
|
||
|
```
|
||
|
Shorthand `u` does NOT work
|
||
|
|
||
|
## uninstall global module
|
||
|
```
|
||
|
npm uninstall -g saxon-js
|
||
|
```
|
||
|
|
||
|
## sources
|
||
|
- https://docs.npmjs.com/cli/v6/commands/npm-install
|
||
|
- https://www.tutorialspoint.com/nodejs/nodejs_npm.htm
|