javascript - TypeError [ERR_INVALID_ARG_TYPE] : The "data" argument must be of type string or an instance of Buffer, TypedArray,或DataView

标签 javascript node.js webpack jestjs

我们的构建环境目前使用 Node 12.19.0 和 npm 6.14.8。当我看到 Node 14.15.1(仍然是 npm 6.14.8)的新 LTS 版本可用时,我下载了它并运行了我们的 webpack 构建脚本并收到了这个错误。新版本的 Node 是否提示始终存在但被 12.19.0 忽略的错误?

internal/fs/utils.js:781
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of XMLElement
    at writeFile (fs.js:1436:5)
    at go$writeFile (/Components/node_modules/graceful-fs/graceful-fs.js:131:14)
    at Object.writeFile (/Components/node_modules/graceful-fs/graceful-fs.js:128:12)
    at /Components/node_modules/jest-html-reporter/dist/main.js:47:13
    at /Components/node_modules/mkdirp/index.js:48:26
    at callback (/Components/node_modules/graceful-fs/polyfills.js:295:20)
    at FSReqCallback.oncomplete (fs.js:184:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

最佳答案

将 jest-html-reporter 版本提升到至少 3.1.3

关于javascript - TypeError [ERR_INVALID_ARG_TYPE] : The "data" argument must be of type string or an instance of Buffer, TypedArray,或DataView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65137938/

相关文章:

javascript - 我如何在 React 组件中将 postcss-bem 与 css-modules 或 postcss-js 一起使用

javascript - 在 Angular 中读取对象内的数组

javascript - 使用 JavaScript 对对象进行排序和数组

javascript - 未定义的后置变量

node.js - Angular/Ionic 处理成功 200 作为错误

webpack - 使用 webpack 和 Electron 的外部

javascript - 通过输入数组字段在控制台中出现未定义的结果

node.js - angular $resource delete 不会将正文发送到 express.js 服务器

node.js - 如何在 ExpressJS 中处理 HTTP 升级?

javascript - webpack 的 require 是如何工作的?