Vite automatically tries to disable the next available port configuration.
See original GitHub issueDescribe the bug
The first bug
First of all, I started a V3 project with the port number of 3000 using parcel2. Then, I configured the port number to be 3000 according to the vite2 document, and I also configured strictport to be true. However, after I started the vite project, the port was 3000, and it was not detected that the 3000 port number was occupied by another project.
The second bug
In addition, let me turn on the vite@2.0.4 And then I started again vite@2.3.1 Project. There is also a problem that no port reuse is detected.
Reproduction
Corresponding to the first bug
package.json
"dependencies": {
"vue": "^3.0.5"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.2.2",
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.3.0"
}
vite.config.js
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
port: 3000,
strictPort: true,
},
});
The picture below is a schematic diagram.
Corresponding to the second bug
The picture below is a schematic diagram.
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Server Options - Vite
Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not...
Read more >Configuring Vite
Configuring Vite #. When running vite from the command line, Vite will automatically try to resolve a config file named vite.config.js inside project...
Read more >Preview Options - Vite
Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not...
Read more >Configuring Vite
In this case, the config file is auto pre-processed before load. ... Vite will automatically try the next available port so this may...
Read more >JavaScript API - Vite
If not set, Vite will try to automatically resolve one from project root. ... config options, plus `mode` and `configFile` preview: { port:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Shinigami92 Sorry, it won’t happen again.
@maomincoding For the future, please do not ping Evan directly. We have an active team around Vite that is working / triaging issues and PRs every day and we decide what is needed to reach Evan so he can manage higher order stuff in the whole Vue ecosystem.