You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the suggestions here don't work, please try posting questions on [GitHub Discussions](https://github.com/vitejs/vite/discussions)or in the `#help` channel of [Vite Land Discord](https://chat.vitejs.dev).
5
+
如果这里的建议并未帮助到你,请将你的问题发送到 [GitHub 讨论区](https://github.com/vitejs/vite/discussions)或 [Vite Land Discord](https://chat.vitejs.dev) 的 `#help` 频道。
The path to your project folder may include `?`, which doesn't work with `npm`on Windows ([npm/cmd-shim#45](https://github.com/npm/cmd-shim/issues/45)).
11
+
你的项目文件夹路径中可能包含了问号 `?`,这在 Windows 上无法与 `npm`配合正常工作 ([npm/cmd-shim#45](https://github.com/npm/cmd-shim/issues/45))。
12
12
13
-
You will need to either:
13
+
你可以选择以下两种修改方式:
14
14
15
-
-Switch to another package manager (e.g. `pnpm`, `yarn`)
16
-
-Remove`?` from the path to your project
15
+
-切换另一种包管理工具(例如 `pnpm` 或 `yarn`)
16
+
-从你的项目路径中移除问号`?`
17
17
18
-
## Dev Server
18
+
## 开发服务器 {#dev-server}
19
19
20
-
### Requests arestalledforever
20
+
### 请求始终停滞 {#requests-are-stalled-forever}
21
21
22
-
If you are using Linux, file descriptor limits and inotify limits may be causing the issue. As Vite does not bundle most of the files, browsers may request many files which require many file descriptors, going over the limit.
22
+
如果你使用的是 Linux,文件描述符限制和 inotify 限制可能会导致这个问题。由于 Vite 不会打包大多数文件,浏览器可能会请求许多文件,而相应地需要许多文件描述符,因此超过了限制。
23
23
24
-
To solve this:
24
+
要解决这个问题:
25
25
26
-
-Increase file descriptor limit by `ulimit`
26
+
-使用 `ulimit` 增加文件描述符的限制
27
27
28
28
```shell
29
-
#Check current limit
29
+
#查看当前限制值
30
30
$ ulimit -Sn
31
-
#Change limit (temporary)
32
-
$ ulimit -Sn 10000 #You might need to change the hard limit too
33
-
#Restart your browser
31
+
#(暂时)更改限制值
32
+
$ ulimit -Sn 10000 #你可能也需要更改硬性限制值
33
+
#重启你的浏览器
34
34
```
35
35
36
-
-Increase the following inotify related limits by `sysctl`
36
+
-通过 `sysctl` 提升下列 inotify 相关的限制
37
37
38
38
```shell
39
-
#Check current limits
39
+
#查看当前限制值
40
40
$ sysctl fs.inotify
41
-
#Change limits (temporary)
41
+
#(暂时)更改限制值
42
42
$ sudo sysctl fs.inotify.max_queued_events=16384
43
43
$ sudo sysctl fs.inotify.max_user_instances=8192
44
44
$ sudo sysctl fs.inotify.max_user_watches=524288
45
45
```
46
46
47
-
## HMR
47
+
## HMR {#hmr}
48
48
49
-
### Vite detects a file changebutthe HMR is notworking
49
+
### Vite 检测到文件变化,但 HMR 不工作 {#vite-detects-a-file-change-but-the-hmr-is-not-working}
50
50
51
-
You may be importing a file with a different case. For example, `src/foo.js`exists and `src/bar.js`contains:
### Vite 没有检测到文件变化 {#vite-does-not-detect-a-file-change}
60
60
61
-
If you are running Vite with WSL2, Vite cannot watch file changes in some conditions. See [`server.watch`option](/config/server-options.md#server-watch).
If HMR is not handled by Vite or a plugin, a full reload will happen.
65
+
如果 HMR 不是由 Vite 或一个插件处理的,那么将进行完全的重新加载。
66
66
67
-
Also if there is a dependency loop, a full reload will happen. To solve this, try removing the loop.
67
+
同时如果有依赖环,也会发生完全重载。要解决这个问题,请先尝试解决依赖循环。
68
68
69
-
## Others
69
+
## 其他 {#others}
70
70
71
-
### Syntax Error / Type Error happens
71
+
### Syntax Error / Type Error {#syntax-error-type-error-happens}
72
72
73
-
Vite cannot handle and does not support code that only runs on non-strict mode (sloppy mode). This is because Vite uses ESM and it is always [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) inside ESM.
73
+
Vite 无法处理、也不支持仅可在非严格模式(sloppy mode)下运行的代码。这是因为 Vite 使用了 ESM 并且始终在 ESM 中使用 [严格模式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)。
74
74
75
-
For example, you might see these errors.
75
+
例如,你可能会看到以下错误。
76
76
77
77
> [ERROR] With statements cannot be used with the "esm" output format due to strict mode
78
78
79
79
> TypeError: Cannot create property 'foo' on boolean 'false'
80
80
81
-
If these code are used inside dependecies, you could use [`patch-package`](https://github.com/ds300/patch-package) (or [`yarn patch`](https://yarnpkg.com/cli/patch) or [`pnpm patch`](https://pnpm.io/cli/patch)) for an escape hatch.
0 commit comments