question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vite automatically tries to disable the next available port configuration.

See original GitHub issue

Describe 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.

The first bug

Corresponding to the second bug

The picture below is a schematic diagram.

The first bug


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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
maomincodingcommented, May 13, 2021

@Shinigami92 Sorry, it won’t happen again.

3reactions
Shinigami92commented, May 13, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found