手记

npm的使用

使用npm之前先安装node.js,因为node.js已经集成了npm
1.测试npm版本    $ npm -v
2.升级npm版本    $ npm install npm -g
3.安装模块           $ npm install <Moudle Name> -g
4.查看所有模块    $ npm list -g
5.只输出两层依赖关系包$ npm list --depath=1 -g
6.查看模块版本号    $ npm list <Moudle Name>
7.卸载模块               $ npm uninstall <Moudle Name>
8.更新模块   $ npm update <Moudle Name>
9.搜索模块   $npm search <Moudle Name>
10.注册用户   $npm adduser
11.发布模块 $npm publish
12.清空npm本地缓存 $npm cache clear
13.安装淘宝镜像        $npm install -g cnpm --registry=https://registry.npm.taobao.org
14.安装运行时依赖包 $npm install --save -prod
15.安装开发时依赖包 $npm install --save -dev
16.执行打包任务    $npm run build
17.执行生成dist目录文件的命令 $npm run dist
18.运行开发测试     $npm run dev
19.运行测试    $npm run test

0人推荐
随时随地看视频
慕课网APP