-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'vue-cli-service serve --port' does not work as advertised #4452
Comments
I have same question. |
Hi, |
Was just about to report the same. I'm using
doesn't do anything, the port is still a random one. |
Well, yes. I spent last night trying all 4 methods I could think of but neither worked.
|
Hi @imaginarny @vkaracic , A way to workaround the problem is to install old portfinder with:
Best Regards, |
Yeah. The previous two days, it still worked. But today, I create a new project, vue.config.js is not worked. What happened. |
https://github.com/http-party/node-portfinder/ released a breaking change as a minor bugfix release, that's what happened... |
Yes, same problem here. The vue.config.js in my project is loading fine but the port 8080 or other port number will not be replaced |
|
@bokub Why should I have to use |
@pravosleva The message is pretty explicit, it says that a valid entry file has not been found. Again, you confuse |
If you use yarn, here's the corresponding workaround. Add this to your
|
Also want to inform that I started a new vue cli project with portfinder resolved to 1.0.22 and encounter this issue. specificying portfinder to 1.0.21 solves the problem. Thanks @mpromonet @ThibaultVlacich |
It does not solve the problem, it is a nasty workaround for a problem that should not exist. |
@ThibaultVlacich Ok. Could you please help me with this: |
删了,整个项目,重新拉了个项目,我就解决了这个问题 |
我安装了electron-cli插件,不知道项目那里被改动了,估计是这个插件导致的问题 |
Thank you, @ThibaultVlacich. I looked for a solution akin to yarn resolutions, but using If anyone is interested, this is the tentative workaround I am currently using. It works for me, but use on your own responsibility:
// pnpmfile.js
module.exports = {
hooks: {
readPackage
}
};
function readPackage (pkg, context) {
if (pkg.name === '@vue/cli-service') {
pkg.dependencies = { portfinder: '1.0.21' };
context.log(`${pkg.name}_${pkg.version}/portfinder 1.0.22 => 1.0.21`);
}
return pkg;
} The hook could check for @vue/cli-service version, not only the name. But since this is a workaround until a patch is merged, I don't think it is much of a problem. Once this issue is fixed, this workaround will no longer be necessary. |
same issue, last update of vue-cli didnt fix the issue if problem is solved |
You can update your apps and remove workarounds. Faulty node-portfinder v1.0.22 was reverted, v1.0.23 is now the same as previously working v1.0.21 #84 |
Fixed in portfinder v1.0.23, please delete your lockfile and try install the dependencies again. |
In case you want to leave the other project dependendcies locked you can also only delete the lockfinder part in the package-lock :)
|
Version
3.10.0
Environment info
Steps to reproduce
run 'npm serve --port ' or 'vue-cli-service serve --port ' in terminal.
What is expected?
i expect the server to listen on the declared port argument or print an error
What is actually happening?
a random port is selected between the declared port argument and portfinder's default max safe port number 40000
i found the code in node_modules/@vue/cli-service/lib/commands/serve.js leveraging portfinder line 80 & 81. it appears portfinder.basePort is set to the port argument, then portfinder.getPortPromise is called, which returns a random port number.
The text was updated successfully, but these errors were encountered: