我正在练习ruby on rails,当终端和rails服务器正在运行时,我不小心关闭了Visual Studio代码。
这是我输入rails s
PS C:UsersLenovoDesktopfolder_nameproject_name rails s
=> Booting Puma
=> Rails 6.1.4.1 application starting in development
=> Run `bin/rails server --help` for more startup options
A server is already running. Check C:/Users/Lenovo/Desktop/folder_name/project_name/tmp/pids/server.pid.
Exiting
可以使用此命令终止端口号的服务器。
sudo kill -9 $(lsof -i :3000 -t)
-
查找rails服务器端口的进程id:
lsof -wni tcp:3000
-
复制PID列的值
-
终止进程(例如14400):
kill -9 14400
用户只需要删除服务器。