我们的构建环境目前使用 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/