markdown npm命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown npm命令相关的知识,希望对你有一定的参考价值。

### config
```shell
# default values when npm init -y
npm config set init.author.name "your name"
npm config set init.author.email "name@mail.com"
```

### add package
```shell
# install from npm repos
npm i <package>
npm i -D <package> #Dev
npm i -G <package> #Global

# install from git base
npm i https://github.com/username/repo.git
npm i github:username/repo
npm i bitbucket:username/repo
npm i gitlab:username/repo
```

### link package
```shell
# symlink mypackage into myproject
cd mypackage
npm link

cd ../myproject
npm link mypackage
```

### execution
```shell
# run scripts in sequence prestart, start, poststart
npm start 
# run scripts in sequence pretest, test, posttest
npm test 
npm t

# download, execute, forget
npx create-react-app my-new-project
```

### list package
```shell
npm list
npm list --deptp=0      # only show first level
npm list --deptp=0 -g   # global

# navigate in browser
npm repo <package>      
npm home <package>
npm docs <package>
```

### cleanup
```shell
# check outdate status
npm outdated

# de-duplicate
npm dedupe
npm ddp
```

以上是关于markdown npm命令的主要内容,如果未能解决你的问题,请参考以下文章

markdown npm命令

markdown npm命令

markdown NPM命令

markdown 有用的npm命令和技巧

markdown NPM脚本命令在课程的各个阶段

markdown Powershell无法识别与NPM全局包相关的命令