导致模块解析失败

导致模块解析失败

本文介绍了fsevents 导致模块解析失败:意外字符""的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 next.js 并且我得到:

I am using next.js and I get:

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,我补充说:

I tried almost everything, most recently, to package.json, I added:

    "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 扩展中添加了:

I fixed it in my VS Code extension by adding:

{
  test: /.node$/,
  loader: 'node-loader',
}

webpack.config.js中的module.rules并添加:

    "node-loader": "^1.0.1",

package.json

这篇关于fsevents 导致模块解析失败:意外字符""的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 18:19