Grunt Serve | connect:livereload端口9000已在使用中

Jer*_*ner 5 gruntjs livereload

我使用Yeoman使用bower和grunt构建一个角度应用程序.运行grunt服务给了我这个错误:

Running "connect:livereload" (connect) task
Fatal error: Port 9000 is already in use by another process.
Run Code Online (Sandbox Code Playgroud)

我有另一个使用端口9000的进程,所以我想改变Grunt的端口.我试图改变我的Gruntfile中的端口,但我继续得到同样的错误.以下是Gruntfile.js中的grunt服务器设置

 connect: {
     options: {
        port: 9002,
        hostname: 'localhost',
        livereload: 35729
  },
Run Code Online (Sandbox Code Playgroud)

Phi*_*son 6

查找使用端口的进程ID:

sudo lsof -i :3000
Run Code Online (Sandbox Code Playgroud)

杀死它:

kill -9 <PID>
Run Code Online (Sandbox Code Playgroud)