如何获得npm可用但未安装在本地的模块树?
NPM ll负责本地安装的包。但对于未安装的模块或全局安装的模块,它不起作用。
我试过npm列表鲍尔,但那不是它。
如何获得npm可用但未安装在本地的模块树?
NPM ll负责本地安装的包。但对于未安装的模块或全局安装的模块,它不起作用。
我试过npm列表鲍尔,但那不是它。
当前回答
查看npm模块的所有元数据
npm view mongoose(module name)
查看模块的所有依赖项
npm view mongoose dependencies
查看所有版本或版本模块
npm view mongoose version
npm view mongoose versions
查看所有关键字
npm view mongoose keywords
其他回答
可以使用npm-remote-ls模块。你可以全局安装它:
npm install -g npm-remote-ls
然后调用:
npm-remote-ls bower
或者,npm@5.2.0安装后,你可以使用npx,避免全局安装命令-只需调用:
npx npm-remote-ls bower
获取一个列表:
% npx npm-remote-ls --flatten dugite -d false -o false
[
'dugite@1.91.3',
'checksum@0.1.1',
'progress@2.0.3',
'mkdirp@0.5.5',
'rimraf@2.7.1',
'tar@4.4.13',
'optimist@0.3.7',
'got@9.6.0',
'minimist@1.2.5',
'chownr@1.1.4',
'glob@7.1.6',
'fs-minipass@1.2.7',
'minizlib@1.3.3',
'minipass@2.9.0',
'safe-buffer@5.2.1',
'yallist@3.1.1',
'wordwrap@0.0.3',
'@szmarczak/http-timer@1.1.2',
'cacheable-request@6.1.0',
'@sindresorhus/is@0.14.0',
'decompress-response@3.3.0',
'duplexer3@0.1.4',
'lowercase-keys@1.0.1',
'mimic-response@1.0.1',
'get-stream@4.1.0',
'to-readable-stream@1.0.0',
'p-cancelable@1.1.0',
'url-parse-lax@3.0.0',
'fs.realpath@1.0.0',
'inflight@1.0.6',
'inherits@2.0.4',
'once@1.4.0',
'path-is-absolute@1.0.1',
'minimatch@3.0.4',
'defer-to-connect@1.1.3',
'clone-response@1.0.2',
'get-stream@5.2.0',
'http-cache-semantics@4.1.0',
'lowercase-keys@2.0.0',
'responselike@1.0.2',
'keyv@3.1.0',
'pump@3.0.0',
'prepend-http@2.0.0',
'normalize-url@4.5.0',
'wrappy@1.0.2',
'brace-expansion@1.1.11',
'json-buffer@3.0.0',
'end-of-stream@1.4.4',
'concat-map@0.0.1',
'balanced-match@1.0.0'
]
这是一个没有权力的官方命令:
npm view <PACKAGE> dependencies
它只打印直接依赖项,而不是整个树。
你可以在不需要安装的情况下生成NPM依赖树 使用命令建立依赖关系
npm list
这将在当前目录为项目生成一个依赖树,并将其打印到控制台。
你可以像这样得到特定依赖项的依赖树:
npm list [dependency]
还可以通过执行设置最大深度级别
npm list --depth=[depth]
请注意,您只能查看已全局或本地安装到NPM项目的依赖项的依赖树。
还有一个很好的web应用程序,可以在加权地图类的视图中查看依赖关系。
例如:
https://bundlephobia.com/result?p=sanitize-html@1.19.1