webpack - webpack next.js TypeError:“原始”参数必须是函数类型
问题描述
运行npm run dev的时候报错:如果有懂的请教教我
// 错误内容
TypeError:“原始”参数必须是函数类型
./node_modules/node-libs-browser/node_modules/util/util.js:602 599 | 600 | export.promisify = function promisify(original) { 601 | if (typeof original !== 'function')
602 | throw new TypeError('“原始”参数必须是函数类型'); 603 | 604 | if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { 605 | var fn = original[kCustomPromisifiedSymbol];
// next.config.js
const withSass = require('@zeit/next-sass');
module.exports = withSass({
/* config options here */
});
module.exports = {
webpack: config => {
config.node = {
fs: 'empty',
child_process: 'empty',
net: 'empty',
dns: 'empty',
tls: 'empty',
};
return config;
},
};
// packege.json
> "dependencies": {
> "@types/react-intl": "^3.0.0",
> "@types/react-lottie": "^1.2.3",
> "@zeit/next-sass": "^1.0.1",
> "child_process": "^1.0.2",
> "googleapis": "^49.0.0",
> "isomorphic-unfetch": "^3.0.0",
> "next": "^9.2.1",
> "node-sass": "^4.13.1",
> "react": "^16.12.0",
> "react-dom": "^16.12.0",
> "react-intl": "^3.12.0",
> "react-lottie": "^1.2.3" }, "devDependencies": {
> "@types/node": "^13.7.0",
> "@types/react": "^16.9.19",
> "typescript": "^3.7.5" }
解决方案
推荐阅读
- mysql - 在 MySQL 的 GROUP BY 子句中从每个组中查找单行
- python - 遍历字典列表
- javascript - React-Table 加 InfiniteScroll 实现未更新
- php - Laravel 5.8:未找到列:1054 多对多关系中的未知列错误
- linux - 如何使用 Linux 4.20.11 作为 Dom0 在 arm64 和 Qemu 6.0.0 上运行 XEN
- javascript - 更改变量的值并检查该值是否已更改
- python - Flask-SQLAlchemy 多重关系问题
- javascript - 如何使用布局文件夹在 nuxt 应用程序中应用布局?
- python - Adobe PDF 服务:神秘(毫无意义?)错误消息
- xml - 定位标签 MESSAGE_RECORD/InsertChange/Bonglinjer/Bonglinje/sumDiscountedPrice/BelopFelt