-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add troubleshooting page (#9379)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
- Loading branch information
1 parent
cd69358
commit c918139
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Troubleshooting | ||
|
||
See [Rollup's troubleshooting guide](https://rollupjs.org/guide/en/#troubleshooting) for more information too. | ||
|
||
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). | ||
|
||
## CLI | ||
|
||
### `Error: Cannot find module 'C:\foo\bar&baz\vite\bin\vite.js'` | ||
|
||
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)). | ||
|
||
You will need to either: | ||
|
||
- Switch to another package manager (e.g. `pnpm`, `yarn`) | ||
- Remove `?` from the path to your project | ||
|
||
## Dev Server | ||
|
||
### Requests are stalled forever | ||
|
||
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. | ||
|
||
To solve this: | ||
|
||
- Increase file descriptor limit by `ulimit` | ||
|
||
```shell | ||
# Check current limit | ||
$ ulimit -Sn | ||
# Change limit (temporary) | ||
$ ulimit -Sn 10000 # You might need to change the hard limit too | ||
# Restart your browser | ||
``` | ||
|
||
- Increase the following inotify related limits by `sysctl` | ||
|
||
```shell | ||
# Check current limits | ||
$ sysctl fs.inotify | ||
# Change limits (temporary) | ||
$ sudo sysctl fs.inotify.max_queued_events=16384 | ||
$ sudo sysctl fs.inotify.max_user_instances=8192 | ||
$ sudo sysctl fs.inotify.max_user_watches=524288 | ||
``` | ||
|
||
## HMR | ||
|
||
### Vite detects a file change but the HMR is not working | ||
|
||
You may be importing a file with a different case. For example, `src/foo.js` exists and `src/bar.js` contains: | ||
|
||
```js | ||
import './Foo.js' // should be './foo.js' | ||
``` | ||
|
||
Related issue: [#964](https://github.com/vitejs/vite/issues/964) | ||
|
||
### Vite does not detect a file change | ||
|
||
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). | ||
|
||
### A full reload happens instead of HMR | ||
|
||
If HMR is not handled by Vite or a plugin, a full reload will happen. | ||
|
||
Also if there is a dependency loop, a full reload will happen. To solve this, try removing the loop. |