微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

child_process.execSync 总是为纱线审计命令返回错误状态 4

如何解决child_process.execSync 总是为纱线审计命令返回错误状态 4

每当我尝试通过 yarn audit 运行 child_process.execSync 命令时,它总是抛出状态为 4 的错误,并且不知道为什么会发生这种情况,也不知道状态 4 是什么意思。无法从 child_process.execSync 的 Node js 文档中获得此状态的任何错误描述。任何有关此错误含义以及需要如何修复的帮助都会非常有帮助。

虽然我在 stdout 对象中收到了所需的输出,但我想修复这个错误

try {
  const result = execSync('yarn audit',{encoding: 'UTF-8'});
  } catch (err) {
  console.log(`err.stdout = ${err.stdout}`);
  console.log(`err.stderr = ${err.stderr}`);
  console.log(`err.pid= ${err.pid}`);
  console.log(`err.signal = ${err.signal}`);
  console.log(`err.status = ${err.status}`);
}

以上输出为:

err.stdout = yarn audit v1.22.10
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ xxxxx                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.16.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ xxxx                                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ xxx > isyyt >xyz >                │
│               │  > xxx             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://www.npmjs.com/advisories/xyz                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
1 vulnerabilities found - Packages audited: 556
Severity: 1 Moderate
Done in 0.91s.

err.stderr = 
err.pid= 13089
err.signal = null
err.status = 4

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。