【问题标题】:npm audit response shows up as just plain text instead of tabular formatnpm 审计响应显示为纯文本而不是表格格式
【发布时间】:2022-08-05 20:08:17
【问题描述】:

我阅读了很多与npm audit 相关的questions/articles,其中人们以表格格式提供了npm audit 的回复。但是当我运行npm audit 时,我得到的响应是纯文本。

我尝试安装库npm-audit-html 并获取answer 中提供的HTML 格式,但这遇到了问题:zsh: command not found: npm-audit-html

有人可以解释并帮助解决npm audit响应的美化问题吗?目前,我的npm audit 回复显示如下:

postcss-overflow-shorthand  <=2.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-overflow-shorthand
  postcss-page-break  <=2.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-page-break
  postcss-place  <=5.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-place
  postcss-pseudo-class-any-link  <=6.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-pseudo-class-any-link
  postcss-reduce-initial  <=4.0.3
  Depends on vulnerable versions of postcss
  node_modules/postcss-reduce-initial
  postcss-reduce-transforms  <=4.0.2
  Depends on vulnerable versions of postcss
  node_modules/postcss-reduce-transforms
  postcss-replace-overflow-wrap  <=3.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-replace-overflow-wrap
  postcss-selector-matches  *
  Depends on vulnerable versions of postcss
  node_modules/postcss-selector-matches
  postcss-selector-not  <=4.0.1
  Depends on vulnerable versions of postcss
  node_modules/postcss-selector-not
  postcss-svgo  <=5.0.0-rc.2
  Depends on vulnerable versions of postcss
  Depends on vulnerable versions of svgo
  node_modules/postcss-svgo
  postcss-unique-selectors  <=4.0.1
  Depends on vulnerable versions of postcss
  node_modules/postcss-unique-selectors
  postcss-url  3.3.0 - 10.0.0
  Depends on vulnerable versions of postcss
  node_modules/postcss-url
  stylehacks  <=4.0.3
  Depends on vulnerable versions of postcss
  node_modules/stylehacks

90 vulnerabilities (84 moderate, 6 high)
  • 我不想把它告诉你,但npm audit --help 会告诉你如果这是一个选项它是如何完成的。也许 mac/linux/windows 版本的节点之间存在实现差异?我不确定...尽管它提供的是 --json 参数,但它与 shell 脚本一样好。你真正需要它做什么?
  • @KamilJanowski 非常感谢您的回复。我知道--json 部分,但它只会以JSON 格式显示。我正在寻找一些可以美化npm audit output 的命令或附加包。我正在使用Macos 来开发我的应用程序。

标签: node.js npm report npm-audit


【解决方案1】:

在 Windows 中,我使用带有 ">" 的 npm audit 将其内容写入 json 文件,请参阅以下命令:

npm audit --json > FOLDER_PATH\FILE_NAME.json

【讨论】:

    猜你喜欢
    • 2019-02-08
    • 2011-04-22
    • 2012-10-24
    • 2023-04-09
    • 1970-01-01
    • 2012-04-17
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多