英文:
No loader is configured in node_modules (fsevents)
问题
I'm using Vite v4.1.1 with Vue 3.2 and all of a sudden got the following error message while running npm run dev
:
[ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevents.node
node_modules/fsevents/fsevents.js:13:23:
13 │ const Native = require("./fsevents.node");
╵ ~~~~~~~~~~~~~~~~~
More error details:
Error: Build failed with 1 error:
errors: [
{
detail: undefined,
id: '',
location: {
column: 23,
file: 'node_modules/fsevents/fsevents.js',
length: 17,
line: 13,
lineText: 'const Native = require("./fsevents.node");',
namespace: '',
suggestion: ''
},
notes: [],
pluginName: '',
text: 'No loader is configured for ".node" files: node_modules/fsevents/fsevents.node'
}
],
warnings: []
}
Node.js v19.6.0
I tried the [fix](https://stackoverflow.com/questions/75640753/vite-esbuild-error-no-loader-is-configured-for-node-files-node-modules-fs) suggested here with no luck, it just introduces more errors with even less explanation.
<details>
<summary>英文:</summary>
I'm using Vite v4.1.1 with Vue 3.2 and all of a sudden got the following error message while running `npm run dev`:
[ERROR] No loader is configured for ".node" files: node_modules/fsevents/fsevents.node
node_modules/fsevents/fsevents.js:13:23:
13 │ const Native = require("./fsevents.node");
╵ ~~~~~~~~~~~~~~~~~
More error details:
Error: Build failed with 1 error:
errors: [
{
detail: undefined,
id: '',
location: {
column: 23,
file: 'node_modules/fsevents/fsevents.js',
length: 17,
line: 13,
lineText: 'const Native = require("./fsevents.node");',
namespace: '',
suggestion: ''
},
notes: [],
pluginName: '',
text: 'No loader is configured for ".node" files: node_modules/fsevents/fsevents.node'
}
],
warnings: []
}
Node.js v19.6.0
I tried the [fix](https://stackoverflow.com/questions/75640753/vite-esbuild-error-no-loader-is-configured-for-node-files-node-modules-fs) suggested here with no luck, it just introduces more errors with even less explanation.
</details>
# 答案1
**得分**: 2
以下是翻译好的内容:
这可能与每个人都无关,但我在Svelte应用程序中遇到了完全相同的错误,并且原因是错误的导入。
我曾经有:
```typescript
import { defineConfig } from "vite";
我的IDE不小心自动导入了这个。删除这个导入修复了问题。
英文:
This might not be relevant to everyone, but I just had this exact error pop up in a Svelte app, and the cause turned out to be an erroneous import.
I had:
import { defineConfig } from "vite";
which I my IDE had accidentally auto imported. Removing the import fixed the issue.
答案2
得分: 2
只移除以下部分来解决这个错误:
"import { resolveBaseUrl } from 'vite';"
英文:
Resolved this error by just removing -
"import { resolveBaseUrl } from 'vite';"
which was imported by itself or maybe accidentally while importing something!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论