npm 查看安装了哪些包的相关指令

npm 查看安装了哪些包

指令1: npm list --depth=0

–depth 表示深度,我们使用的模块会有依赖,深度为零的时候,不会显示依赖模块

这个指令可以用来 显示 出我们的项目中安装了哪些模块,其实就是 package.json 文件中 的 dependencies 和 devDependencies 的和

PS C:\Users\by\Desktop\jsPang\awesomePos> npm list --depth=0
awesome_pos@1.0.0 C:\Users\by\Desktop\jsPang\awesomePos
+-- autoprefixer@7.2.6
+-- babel-core@6.26.0
+-- babel-helper-vue-jsx-merge-props@2.0.3
+-- babel-loader@7.1.4
+-- babel-plugin-syntax-jsx@6.18.0
+-- babel-plugin-transform-runtime@6.23.0
+-- babel-plugin-transform-vue-jsx@3.7.0
+-- babel-preset-env@1.6.1
+-- babel-preset-stage-2@6.24.1
+-- chalk@2.3.2
+-- copy-webpack-plugin@4.5.1
+-- css-loader@0.28.11
+-- element-ui@2.2.2
+-- extract-text-webpack-plugin@3.0.2
+-- file-loader@1.1.11
+-- friendly-errors-webpack-plugin@1.6.1
+-- html-webpack-plugin@2.30.1
+-- node-notifier@5.2.1
+-- optimize-css-assets-webpack-plugin@3.2.0
+-- ora@1.4.0
+-- portfinder@1.0.13
+-- postcss-import@11.1.0
+-- postcss-loader@2.1.3
+-- postcss-url@7.3.1
+-- rimraf@2.6.2
+-- semver@5.5.0
+-- shelljs@0.7.8
+-- uglifyjs-webpack-plugin@1.2.4
+-- url-loader@0.5.9
+-- vue@2.5.16
+-- vue-loader@13.7.1
+-- vue-router@3.0.1
+-- vue-style-loader@3.1.2
+-- vue-template-compiler@2.5.16
+-- webpack@3.11.0
+-- webpack-bundle-analyzer@2.11.1
+-- webpack-dev-server@2.11.2
`-- [email protected]

当然我们可以在加参数 npm list --depth=0 [--dev | --production]

指令2: npm list --depth --global

这个指令用来查看全局安装了哪些工具

PS C:\Users\by\Desktop\jsPang\awesomePos> npm list --depth=0 --global
C:\Users\by\AppData\Roaming\npm
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

指令3: npm list

这个指令用来查看某个模块是否安装了

PS C:\Users\by\Desktop\jsPang\awesomePos> npm list element-ui
[email protected] C:\Users\by\Desktop\jsPang\awesomePos
`-- [email protected]

官网详情

这篇文章目的在于推荐下几个常用的指令

传送门

你可能感兴趣的:(javascript,前端,npm)