webpack - fsevents 导致模块解析失败:意外字符“�”
问题描述
我正在使用next.js
,我得到:
Failed to compile.
./node_modules/fsevents/fsevents.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
我几乎尝试了一切,最近,package.json
我补充说:
"optionalDependencies": {
"fsevents": "^2.1.3"
}
在next.config.js
中,我有:
const withImages = require("next-images");
const withPlugins = require("next-compose-plugins");
const withCSS = require("@zeit/next-css");
module.exports = withPlugins([
withCSS,
withImages,
]
不知道还能做什么。
解决方案
我通过添加以下内容在我的 VS Code 扩展中修复了它:
{
test: /.node$/,
loader: 'node-loader',
}
并module.rules
添加webpack.config.js
:
"node-loader": "^1.0.1",
到devDependencies
里面package.json
推荐阅读
- ubuntu-16.04 - 如何使用jubula的操作系统在ubuntu上执行externalcommand
- r - 在智能手机上使用,闪亮的交互式情节无法理解手指动作
- node.js - 我是否必须使用与创建重定向 URL 相同的 oAuth2Client 来调用谷歌日历 API,或者我可以使用新实例吗
- gremlin - 只运行一次sideEffect
- php - TYPO3 SURF - 部署非 TYPO3 项目
- node.js - 无法使用 sequelize 仅返回嵌套模型属性
- azure - 如何在同一发布管道中的任务之间共享相同的 Azure 服务连接
- python - 如何简单地导入文件
- inkscape - 如何在 Inkscape 中定义 .inx 参数的最大值以依赖于其他参数
- java - 使用套接字来自服务器的实时数据