Svelte项目错误端口3000已经在使用

发布于 2025-02-11 14:11:05 字数 302 浏览 0 评论 0原文

我是Web开发的新手,甚至对Svelte更新。我打开了一个项目,一切都很好。当我运行“ NPM Run Dev”时,它将我指向Localhost 8080,一切都启动了,并且我的代码在浏览器上进行了更改。好的。第二天,当我打开VS代码并在终端中输入“ NPM Run Dev”时,什么也没发生,或者告诉我使用端口3000(不起作用),或者告诉我端口3000已经使用。无论如何,我根本无法再观看汇总了。这一切都非常奇怪,因为我唯一要做的就是在晚上关闭VScode,然后第二天重新开放该项目。我什么都没改变。我真的不知道该怎么办,除了启动一个新项目,并且在完成之前永远不会关闭它。我在做什么错?

I'm new to web development, and even newer to Svelte. I opened up a project and everything went fine. When I ran 'npm run dev' it pointed me to localhost 8080 and everything went well--rollup launched and my code was changed live on the browser. Nice. The next day when I opened up vs code and typed 'npm run dev' in the terminal, either nothing happened, or it told me to use port 3000 (which doesn't work) or told me port 3000 is already in used. Anyway, I simply cannot get Rollup to watch anymore. This is all very strange since the only thing I did was shut down VSCode for the evening and then reopen the project the next day; I didn't change anything. I really have no idea what to do except start a new project and never ever close it down until I'm done. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回旧景 2025-02-18 14:11:06

有时,当我从VS代码终端启动服务器时,然后关闭VS代码而不停止服务器时,服务器仍在运行和使用端口。 (Windows 11)

为了确保不会发生这种情况,请在退出VS代码之前始终杀死服务器进程。 ( ctrl - c 焦点在终端内)。

要从僵尸服务器过程中释放端口,您将需要杀死该过程或重新启动。

Sometimes when I start a server from a VS Code terminal, then close VS Code without stopping the server, the server is still running and using the port. (Windows 11)

To ensure this doesn't happen, always kill the server process before exiting VS Code. (CTRL-C while focus is inside terminal).

To free the port from a zombie server process, you will either need to kill the process or reboot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文