“Port 4200 is already in use” when running the ng serve command











up vote
86
down vote

favorite
34












I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project.



I was able to run the command "ng serve" and it works great. I wanted to stop it from running so I ran "Control Z".



When I tried to run the "ng-serve" command again it gives me "Port 4200 is already in use."



I ran "PS" to get a list of the PID and killed the PID for the angular-cli and ran "ng-serve" again still it gives the same port in use error.










share|improve this question


























    up vote
    86
    down vote

    favorite
    34












    I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project.



    I was able to run the command "ng serve" and it works great. I wanted to stop it from running so I ran "Control Z".



    When I tried to run the "ng-serve" command again it gives me "Port 4200 is already in use."



    I ran "PS" to get a list of the PID and killed the PID for the angular-cli and ran "ng-serve" again still it gives the same port in use error.










    share|improve this question
























      up vote
      86
      down vote

      favorite
      34









      up vote
      86
      down vote

      favorite
      34






      34





      I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project.



      I was able to run the command "ng serve" and it works great. I wanted to stop it from running so I ran "Control Z".



      When I tried to run the "ng-serve" command again it gives me "Port 4200 is already in use."



      I ran "PS" to get a list of the PID and killed the PID for the angular-cli and ran "ng-serve" again still it gives the same port in use error.










      share|improve this question













      I am learning angular 2 and for the first time I am using the angular CLI project to create a sandbox project.



      I was able to run the command "ng serve" and it works great. I wanted to stop it from running so I ran "Control Z".



      When I tried to run the "ng-serve" command again it gives me "Port 4200 is already in use."



      I ran "PS" to get a list of the PID and killed the PID for the angular-cli and ran "ng-serve" again still it gives the same port in use error.







      angular






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 23 '16 at 3:13









      peztherez

      71821117




      71821117
























          34 Answers
          34






          active

          oldest

          votes













          1 2
          next











          up vote
          133
          down vote



          accepted










          This is what I used to kill the progress on port 4200



          sudo kill $(sudo lsof -t -i:4200)


          You could also try this:



          sudo kill `sudo lsof -t -i:4200`


          For windows users:



          Port number 4200 is already in use. Type below command in cmd:



          netstat -a -n -o


          And then, find port with port number 4200 by right click on terminal and click find, enter 4200 in "find what" and click "find next":
          Let say you found that port number 4200 is used by pid 18932. Type below command in cmd:



          taskkill -f /pid 18932





          share|improve this answer



















          • 21




            This does not work for Windows users
            – Hinrich
            Jan 23 '17 at 8:49






          • 1




            While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
            – Nathan Dunn
            May 2 '17 at 4:49






          • 4




            You can specify a different port with: --port <new_port>
            – hestellez
            Jun 10 '17 at 5:07








          • 2




            This kills the default browser. And not helpful.
            – shijin
            Jun 20 '17 at 13:08






          • 4




            this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
            – tenCupMaximum
            Jul 25 '17 at 1:56


















          up vote
          107
          down vote













          Open your cmd.exe as administrator,



          then Find the PID of port 4200



          netstat -ano | findstr :4200


          Pid for port 4200



          Here i have 3 PID :




          • Red one is from "ng-serve" (127.0.0.1:4200) that LISTENING

          • Green one is from "your browser"


          kill only port 4200 (kill the red PID):



          taskkill /PID 15940 /F


          note : kill the green one will only lead your browser closed by force.



          taskkill pid 15940



          now you can do "ng-serve" to start your angular app at the same port 4200









          Additional Stuff :



          One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)



          for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a





          share|improve this answer



















          • 5




            Added one-line code for windows command prompt, thanks ^^.
            – Anthony Kal
            Jul 13 '17 at 3:36








          • 2




            Remember to do it in cmd, not Git Bash.
            – Leo
            Nov 12 '17 at 0:30






          • 1




            Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
            – intotecho
            Mar 7 at 2:00












          • Updating GIt Bash fix my problem
            – Ismail Farooq
            Mar 20 at 6:43










          • This should be accepted as answer
            – andrey.shedko
            Nov 21 at 12:22


















          up vote
          46
          down vote













          On Mac OS X you need the following command:



          sudo lsof -t -i tcp:4200 | xargs kill -9



          Remember you need to kill Angular's web server with Command+C.






          share|improve this answer




























            up vote
            9
            down vote













            Not ctrl+Z,
            you must run for stop ctrl+C
            it's worked, I checking






            share|improve this answer























            • by far the simplest solution to the problem, even if technically it does not respond to the OP question
              – Flo
              Nov 21 at 9:04


















            up vote
            8
            down vote













            Use this command to kill ng:



            pkill -9 ng





            share|improve this answer




























              up vote
              8
              down vote













              ng serve --port <YOUR_GIVEN_PORT_NUMBER>



              You should try above command to run on your given port.






              share|improve this answer




























                up vote
                7
                down vote













                I also faced the same error msg, so i tried ng serve --port 12012 and it worked fine.






                share|improve this answer

















                • 5




                  we cannot alot new port everytime.
                  – shijin
                  Jun 20 '17 at 13:09






                • 7




                  Who is upvoting answers like these?
                  – shark1608
                  Nov 10 '17 at 17:55


















                up vote
                6
                down vote













                When you use Ctrl+Z, you are going to suspend a running task but not to kill it. You can later use command fg to resume the task.
                If you want to quit ng serve, you should use Ctrl+C instead, in which will also release the 4200 port.






                share|improve this answer




























                  up vote
                  5
                  down vote













                  We can forcefully kill the port by following command.



                  kill -2 $(lsof -t -i:4200)





                  share|improve this answer






























                    up vote
                    4
                    down vote













                    ng serve --port 4201 --live-reload-port 4200


                    and access using localhost:4201



                    This should work as a temporary solution.



                    or



                    try listing port usage using
                    lsof -i:4200

                    and kill it manually using
                    sudo kill -9 <Process PID using port 4200>






                    share|improve this answer






























                      up vote
                      3
                      down vote













                      For Windows:



                      Open Command Prompt and



                      type: netstat -a -o -n



                      Find the PID of the process that you want to kill.



                      Type: taskkill /F /PID 16876



                      This one 16876 - is the PID for the process that I want to kill - in that case, the process is 4200 - check the attached file.you can give any port number.



                      enter image description here



                      Now, Type : ng serve to start your angular app at the same port 4200






                      share|improve this answer






























                        up vote
                        2
                        down vote













                        netstat -anp | grep ":4200"


                        This will tell you who's got the port.






                        share|improve this answer





















                        • is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                          – peztherez
                          Aug 23 '16 at 3:38












                        • Your netstat must be different from mine. Maybe add an OS tag.
                          – Joshua
                          Aug 23 '16 at 21:26


















                        up vote
                        2
                        down vote













                        The most simple one line command:



                         sudo fuser -k 4200/tcp





                        share|improve this answer




























                          up vote
                          1
                          down vote













                          You can also try with this to run your application in visual studio code -:



                          ng serve --open --port 4201


                          you can give any port number.






                          share|improve this answer




























                            up vote
                            1
                            down vote













                            you can use fuser -k 4200/tcp if it is Linux Operating system






                            share|improve this answer




























                              up vote
                              1
                              down vote













                              Kill process and close the terminal which you used for running the app on that port.






                              share|improve this answer




























                                up vote
                                1
                                down vote













                                Instead of killing the whole process or using ctrl+z, you can simply use ctrl+c to stop the server and can happily use ng serve command without any errors or if you want to run on a different port simply use this command ng serve --port portno(ex: ng serve --port 4201).






                                share|improve this answer






























                                  up vote
                                  1
                                  down vote













                                  With ctrl + z you put the program in the background.
                                  On Linux you can get the session back in the foreground with the following command:



                                  fg ng serve



                                  You don't need to kill the process.






                                  share|improve this answer




























                                    up vote
                                    0
                                    down vote













                                    If you compiling your angular JS code in both CMD and IDE then this issue occur. In CMD, your angular JS code compile automatically whenever you change your angular JS code in IDE and then your IDE want to occupy the same port i.e 4200 which is occupied by CMD already
                                    So, there is a simple solution for this issue, just close your cmd while compiling your code in IDE.






                                    share|improve this answer




























                                      up vote
                                      0
                                      down vote













                                      I was facing the same issue every time I have to kill the port.



                                      I tried ./node_modules/.bin/ng serve --proxy-config proxy.conf.json --host 0.0.0.0 Instead of npm start and its works






                                      share|improve this answer




























                                        up vote
                                        0
                                        down vote













                                        On linux mint 17, this is working.



                                        kill -9 $(lsof -t -i:4200)






                                        share|improve this answer




























                                          up vote
                                          0
                                          down vote













                                          It is possible to change port in .angular-cli file. For example:



                                          "defaults": {
                                          "styleExt": "css",
                                          "component": {},
                                          "serve": {
                                          "port": 4205
                                          }
                                          }


                                          In addition, it is necessary to add this to your package.json:



                                          "ng": "ng",
                                          "start": "ng serve"





                                          share|improve this answer




























                                            up vote
                                            0
                                            down vote













                                            It says already we are running the services with port no 4200 please use another port instead of 4200. Below command is to solve the problem




                                            ng serve --port 4300







                                            share|improve this answer






























                                              up vote
                                              0
                                              down vote













                                              Port 4200 is already in use. Use '--port' to specify a different port


                                              This means that you already have another service running on port 4200. If this is the case
                                              you can either . shut down the other service. use the --port flag when running ng
                                              serve like this:



                                               ng serve --port 9001


                                              Another thing to notice is that, on some machines, the domain localhost may not work.
                                              You may see a set of numbers such as 127.0.0.1. When you run ng serve it should show
                                              you what URL the server is running on, so be sure to read the messages on your machine
                                              to find your exact development URL.






                                              share|improve this answer




























                                                up vote
                                                0
                                                down vote













                                                netstat -plnet



                                                tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN 1001 63955 7077/ng



                                                kill -9 7077



                                                again start your ng serve.






                                                share|improve this answer

















                                                • 1




                                                  While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                  – Filnor
                                                  Jun 8 at 6:06


















                                                up vote
                                                0
                                                down vote













                                                In Windows; In command prompt which is running your ng serve just click and press keys:



                                                ctrl + c


                                                It will ask you: Terminate batch job (Y/N)?
                                                and you type Y






                                                share|improve this answer




























                                                  up vote
                                                  0
                                                  down vote













                                                  As first step after any changes, I use ng build, then ng serve. It works without any problems.






                                                  share|improve this answer




























                                                    up vote
                                                    0
                                                    down vote













                                                    Just restart the IDE you are using, then it will work.






                                                    share|improve this answer




























                                                      up vote
                                                      0
                                                      down vote













                                                      Only thing that works for me is to restart my system / device...



                                                      Using Webstorm IDE by JetBrains.






                                                      share|improve this answer






























                                                        up vote
                                                        0
                                                        down vote













                                                        To Access project outside localhost



                                                        Example:



                                                        ng serve --host 192.168.2.2:7006





                                                        share|improve this answer

























                                                          1 2
                                                          next



                                                          Your Answer






                                                          StackExchange.ifUsing("editor", function () {
                                                          StackExchange.using("externalEditor", function () {
                                                          StackExchange.using("snippets", function () {
                                                          StackExchange.snippets.init();
                                                          });
                                                          });
                                                          }, "code-snippets");

                                                          StackExchange.ready(function() {
                                                          var channelOptions = {
                                                          tags: "".split(" "),
                                                          id: "1"
                                                          };
                                                          initTagRenderer("".split(" "), "".split(" "), channelOptions);

                                                          StackExchange.using("externalEditor", function() {
                                                          // Have to fire editor after snippets, if snippets enabled
                                                          if (StackExchange.settings.snippets.snippetsEnabled) {
                                                          StackExchange.using("snippets", function() {
                                                          createEditor();
                                                          });
                                                          }
                                                          else {
                                                          createEditor();
                                                          }
                                                          });

                                                          function createEditor() {
                                                          StackExchange.prepareEditor({
                                                          heartbeatType: 'answer',
                                                          convertImagesToLinks: true,
                                                          noModals: true,
                                                          showLowRepImageUploadWarning: true,
                                                          reputationToPostImages: 10,
                                                          bindNavPrevention: true,
                                                          postfix: "",
                                                          imageUploader: {
                                                          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                                                          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                                                          allowUrls: true
                                                          },
                                                          onDemand: false,
                                                          discardSelector: ".discard-answer"
                                                          ,immediatelyShowMarkdownHelp:true
                                                          });


                                                          }
                                                          });














                                                           

                                                          draft saved


                                                          draft discarded


















                                                          StackExchange.ready(
                                                          function () {
                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39091735%2fport-4200-is-already-in-use-when-running-the-ng-serve-command%23new-answer', 'question_page');
                                                          }
                                                          );

                                                          Post as a guest















                                                          Required, but never shown




















                                                          StackExchange.ready(function () {
                                                          $("#show-editor-button input, #show-editor-button button").click(function () {
                                                          var showEditor = function() {
                                                          $("#show-editor-button").hide();
                                                          $("#post-form").removeClass("dno");
                                                          StackExchange.editor.finallyInit();
                                                          };

                                                          var useFancy = $(this).data('confirm-use-fancy');
                                                          if(useFancy == 'True') {
                                                          var popupTitle = $(this).data('confirm-fancy-title');
                                                          var popupBody = $(this).data('confirm-fancy-body');
                                                          var popupAccept = $(this).data('confirm-fancy-accept-button');

                                                          $(this).loadPopup({
                                                          url: '/post/self-answer-popup',
                                                          loaded: function(popup) {
                                                          var pTitle = $(popup).find('h2');
                                                          var pBody = $(popup).find('.popup-body');
                                                          var pSubmit = $(popup).find('.popup-submit');

                                                          pTitle.text(popupTitle);
                                                          pBody.html(popupBody);
                                                          pSubmit.val(popupAccept).click(showEditor);
                                                          }
                                                          })
                                                          } else{
                                                          var confirmText = $(this).data('confirm-text');
                                                          if (confirmText ? confirm(confirmText) : true) {
                                                          showEditor();
                                                          }
                                                          }
                                                          });
                                                          });






                                                          34 Answers
                                                          34






                                                          active

                                                          oldest

                                                          votes








                                                          34 Answers
                                                          34






                                                          active

                                                          oldest

                                                          votes









                                                          active

                                                          oldest

                                                          votes






                                                          active

                                                          oldest

                                                          votes








                                                          1 2
                                                          next









                                                          up vote
                                                          133
                                                          down vote



                                                          accepted










                                                          This is what I used to kill the progress on port 4200



                                                          sudo kill $(sudo lsof -t -i:4200)


                                                          You could also try this:



                                                          sudo kill `sudo lsof -t -i:4200`


                                                          For windows users:



                                                          Port number 4200 is already in use. Type below command in cmd:



                                                          netstat -a -n -o


                                                          And then, find port with port number 4200 by right click on terminal and click find, enter 4200 in "find what" and click "find next":
                                                          Let say you found that port number 4200 is used by pid 18932. Type below command in cmd:



                                                          taskkill -f /pid 18932





                                                          share|improve this answer



















                                                          • 21




                                                            This does not work for Windows users
                                                            – Hinrich
                                                            Jan 23 '17 at 8:49






                                                          • 1




                                                            While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                            – Nathan Dunn
                                                            May 2 '17 at 4:49






                                                          • 4




                                                            You can specify a different port with: --port <new_port>
                                                            – hestellez
                                                            Jun 10 '17 at 5:07








                                                          • 2




                                                            This kills the default browser. And not helpful.
                                                            – shijin
                                                            Jun 20 '17 at 13:08






                                                          • 4




                                                            this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                            – tenCupMaximum
                                                            Jul 25 '17 at 1:56















                                                          up vote
                                                          133
                                                          down vote



                                                          accepted










                                                          This is what I used to kill the progress on port 4200



                                                          sudo kill $(sudo lsof -t -i:4200)


                                                          You could also try this:



                                                          sudo kill `sudo lsof -t -i:4200`


                                                          For windows users:



                                                          Port number 4200 is already in use. Type below command in cmd:



                                                          netstat -a -n -o


                                                          And then, find port with port number 4200 by right click on terminal and click find, enter 4200 in "find what" and click "find next":
                                                          Let say you found that port number 4200 is used by pid 18932. Type below command in cmd:



                                                          taskkill -f /pid 18932





                                                          share|improve this answer



















                                                          • 21




                                                            This does not work for Windows users
                                                            – Hinrich
                                                            Jan 23 '17 at 8:49






                                                          • 1




                                                            While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                            – Nathan Dunn
                                                            May 2 '17 at 4:49






                                                          • 4




                                                            You can specify a different port with: --port <new_port>
                                                            – hestellez
                                                            Jun 10 '17 at 5:07








                                                          • 2




                                                            This kills the default browser. And not helpful.
                                                            – shijin
                                                            Jun 20 '17 at 13:08






                                                          • 4




                                                            this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                            – tenCupMaximum
                                                            Jul 25 '17 at 1:56













                                                          up vote
                                                          133
                                                          down vote



                                                          accepted







                                                          up vote
                                                          133
                                                          down vote



                                                          accepted






                                                          This is what I used to kill the progress on port 4200



                                                          sudo kill $(sudo lsof -t -i:4200)


                                                          You could also try this:



                                                          sudo kill `sudo lsof -t -i:4200`


                                                          For windows users:



                                                          Port number 4200 is already in use. Type below command in cmd:



                                                          netstat -a -n -o


                                                          And then, find port with port number 4200 by right click on terminal and click find, enter 4200 in "find what" and click "find next":
                                                          Let say you found that port number 4200 is used by pid 18932. Type below command in cmd:



                                                          taskkill -f /pid 18932





                                                          share|improve this answer














                                                          This is what I used to kill the progress on port 4200



                                                          sudo kill $(sudo lsof -t -i:4200)


                                                          You could also try this:



                                                          sudo kill `sudo lsof -t -i:4200`


                                                          For windows users:



                                                          Port number 4200 is already in use. Type below command in cmd:



                                                          netstat -a -n -o


                                                          And then, find port with port number 4200 by right click on terminal and click find, enter 4200 in "find what" and click "find next":
                                                          Let say you found that port number 4200 is used by pid 18932. Type below command in cmd:



                                                          taskkill -f /pid 18932






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Nov 19 '17 at 19:50









                                                          Rajat Surana

                                                          1006




                                                          1006










                                                          answered Aug 26 '16 at 15:34









                                                          Bart Hoekstra

                                                          1,88011012




                                                          1,88011012








                                                          • 21




                                                            This does not work for Windows users
                                                            – Hinrich
                                                            Jan 23 '17 at 8:49






                                                          • 1




                                                            While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                            – Nathan Dunn
                                                            May 2 '17 at 4:49






                                                          • 4




                                                            You can specify a different port with: --port <new_port>
                                                            – hestellez
                                                            Jun 10 '17 at 5:07








                                                          • 2




                                                            This kills the default browser. And not helpful.
                                                            – shijin
                                                            Jun 20 '17 at 13:08






                                                          • 4




                                                            this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                            – tenCupMaximum
                                                            Jul 25 '17 at 1:56














                                                          • 21




                                                            This does not work for Windows users
                                                            – Hinrich
                                                            Jan 23 '17 at 8:49






                                                          • 1




                                                            While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                            – Nathan Dunn
                                                            May 2 '17 at 4:49






                                                          • 4




                                                            You can specify a different port with: --port <new_port>
                                                            – hestellez
                                                            Jun 10 '17 at 5:07








                                                          • 2




                                                            This kills the default browser. And not helpful.
                                                            – shijin
                                                            Jun 20 '17 at 13:08






                                                          • 4




                                                            this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                            – tenCupMaximum
                                                            Jul 25 '17 at 1:56








                                                          21




                                                          21




                                                          This does not work for Windows users
                                                          – Hinrich
                                                          Jan 23 '17 at 8:49




                                                          This does not work for Windows users
                                                          – Hinrich
                                                          Jan 23 '17 at 8:49




                                                          1




                                                          1




                                                          While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                          – Nathan Dunn
                                                          May 2 '17 at 4:49




                                                          While I realize that this is the correct solution, does this not seem to be a horrible solution? What if I want to run ng serve on a different directory? Doesn't make sense to kill the server this way and then restart it somewhere else or am I missing something?
                                                          – Nathan Dunn
                                                          May 2 '17 at 4:49




                                                          4




                                                          4




                                                          You can specify a different port with: --port <new_port>
                                                          – hestellez
                                                          Jun 10 '17 at 5:07






                                                          You can specify a different port with: --port <new_port>
                                                          – hestellez
                                                          Jun 10 '17 at 5:07






                                                          2




                                                          2




                                                          This kills the default browser. And not helpful.
                                                          – shijin
                                                          Jun 20 '17 at 13:08




                                                          This kills the default browser. And not helpful.
                                                          – shijin
                                                          Jun 20 '17 at 13:08




                                                          4




                                                          4




                                                          this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                          – tenCupMaximum
                                                          Jul 25 '17 at 1:56




                                                          this did murder my browser window. I figured it out eventually though... I had done a ^Z on an existing angular instance that was using the default port, silly me!
                                                          – tenCupMaximum
                                                          Jul 25 '17 at 1:56












                                                          up vote
                                                          107
                                                          down vote













                                                          Open your cmd.exe as administrator,



                                                          then Find the PID of port 4200



                                                          netstat -ano | findstr :4200


                                                          Pid for port 4200



                                                          Here i have 3 PID :




                                                          • Red one is from "ng-serve" (127.0.0.1:4200) that LISTENING

                                                          • Green one is from "your browser"


                                                          kill only port 4200 (kill the red PID):



                                                          taskkill /PID 15940 /F


                                                          note : kill the green one will only lead your browser closed by force.



                                                          taskkill pid 15940



                                                          now you can do "ng-serve" to start your angular app at the same port 4200









                                                          Additional Stuff :



                                                          One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)



                                                          for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a





                                                          share|improve this answer



















                                                          • 5




                                                            Added one-line code for windows command prompt, thanks ^^.
                                                            – Anthony Kal
                                                            Jul 13 '17 at 3:36








                                                          • 2




                                                            Remember to do it in cmd, not Git Bash.
                                                            – Leo
                                                            Nov 12 '17 at 0:30






                                                          • 1




                                                            Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                            – intotecho
                                                            Mar 7 at 2:00












                                                          • Updating GIt Bash fix my problem
                                                            – Ismail Farooq
                                                            Mar 20 at 6:43










                                                          • This should be accepted as answer
                                                            – andrey.shedko
                                                            Nov 21 at 12:22















                                                          up vote
                                                          107
                                                          down vote













                                                          Open your cmd.exe as administrator,



                                                          then Find the PID of port 4200



                                                          netstat -ano | findstr :4200


                                                          Pid for port 4200



                                                          Here i have 3 PID :




                                                          • Red one is from "ng-serve" (127.0.0.1:4200) that LISTENING

                                                          • Green one is from "your browser"


                                                          kill only port 4200 (kill the red PID):



                                                          taskkill /PID 15940 /F


                                                          note : kill the green one will only lead your browser closed by force.



                                                          taskkill pid 15940



                                                          now you can do "ng-serve" to start your angular app at the same port 4200









                                                          Additional Stuff :



                                                          One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)



                                                          for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a





                                                          share|improve this answer



















                                                          • 5




                                                            Added one-line code for windows command prompt, thanks ^^.
                                                            – Anthony Kal
                                                            Jul 13 '17 at 3:36








                                                          • 2




                                                            Remember to do it in cmd, not Git Bash.
                                                            – Leo
                                                            Nov 12 '17 at 0:30






                                                          • 1




                                                            Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                            – intotecho
                                                            Mar 7 at 2:00












                                                          • Updating GIt Bash fix my problem
                                                            – Ismail Farooq
                                                            Mar 20 at 6:43










                                                          • This should be accepted as answer
                                                            – andrey.shedko
                                                            Nov 21 at 12:22













                                                          up vote
                                                          107
                                                          down vote










                                                          up vote
                                                          107
                                                          down vote









                                                          Open your cmd.exe as administrator,



                                                          then Find the PID of port 4200



                                                          netstat -ano | findstr :4200


                                                          Pid for port 4200



                                                          Here i have 3 PID :




                                                          • Red one is from "ng-serve" (127.0.0.1:4200) that LISTENING

                                                          • Green one is from "your browser"


                                                          kill only port 4200 (kill the red PID):



                                                          taskkill /PID 15940 /F


                                                          note : kill the green one will only lead your browser closed by force.



                                                          taskkill pid 15940



                                                          now you can do "ng-serve" to start your angular app at the same port 4200









                                                          Additional Stuff :



                                                          One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)



                                                          for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a





                                                          share|improve this answer














                                                          Open your cmd.exe as administrator,



                                                          then Find the PID of port 4200



                                                          netstat -ano | findstr :4200


                                                          Pid for port 4200



                                                          Here i have 3 PID :




                                                          • Red one is from "ng-serve" (127.0.0.1:4200) that LISTENING

                                                          • Green one is from "your browser"


                                                          kill only port 4200 (kill the red PID):



                                                          taskkill /PID 15940 /F


                                                          note : kill the green one will only lead your browser closed by force.



                                                          taskkill pid 15940



                                                          now you can do "ng-serve" to start your angular app at the same port 4200









                                                          Additional Stuff :



                                                          One liner : After looking a way to optimize this, Here is the One-liner command of this answer : (special thanks to : Josep Alsina for this tips)



                                                          for /f "tokens=5" %a in ('netstat -ano ^| find "4200" ^| find "LISTENING"') do taskkill /f /pid %a






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Jul 13 '17 at 7:37

























                                                          answered Mar 20 '17 at 4:59









                                                          Anthony Kal

                                                          1,2491911




                                                          1,2491911








                                                          • 5




                                                            Added one-line code for windows command prompt, thanks ^^.
                                                            – Anthony Kal
                                                            Jul 13 '17 at 3:36








                                                          • 2




                                                            Remember to do it in cmd, not Git Bash.
                                                            – Leo
                                                            Nov 12 '17 at 0:30






                                                          • 1




                                                            Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                            – intotecho
                                                            Mar 7 at 2:00












                                                          • Updating GIt Bash fix my problem
                                                            – Ismail Farooq
                                                            Mar 20 at 6:43










                                                          • This should be accepted as answer
                                                            – andrey.shedko
                                                            Nov 21 at 12:22














                                                          • 5




                                                            Added one-line code for windows command prompt, thanks ^^.
                                                            – Anthony Kal
                                                            Jul 13 '17 at 3:36








                                                          • 2




                                                            Remember to do it in cmd, not Git Bash.
                                                            – Leo
                                                            Nov 12 '17 at 0:30






                                                          • 1




                                                            Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                            – intotecho
                                                            Mar 7 at 2:00












                                                          • Updating GIt Bash fix my problem
                                                            – Ismail Farooq
                                                            Mar 20 at 6:43










                                                          • This should be accepted as answer
                                                            – andrey.shedko
                                                            Nov 21 at 12:22








                                                          5




                                                          5




                                                          Added one-line code for windows command prompt, thanks ^^.
                                                          – Anthony Kal
                                                          Jul 13 '17 at 3:36






                                                          Added one-line code for windows command prompt, thanks ^^.
                                                          – Anthony Kal
                                                          Jul 13 '17 at 3:36






                                                          2




                                                          2




                                                          Remember to do it in cmd, not Git Bash.
                                                          – Leo
                                                          Nov 12 '17 at 0:30




                                                          Remember to do it in cmd, not Git Bash.
                                                          – Leo
                                                          Nov 12 '17 at 0:30




                                                          1




                                                          1




                                                          Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                          – intotecho
                                                          Mar 7 at 2:00






                                                          Syntsax for GitBash on Windows netstat -ano | findstr :4200; taskkill -PID <establishedPID> -F
                                                          – intotecho
                                                          Mar 7 at 2:00














                                                          Updating GIt Bash fix my problem
                                                          – Ismail Farooq
                                                          Mar 20 at 6:43




                                                          Updating GIt Bash fix my problem
                                                          – Ismail Farooq
                                                          Mar 20 at 6:43












                                                          This should be accepted as answer
                                                          – andrey.shedko
                                                          Nov 21 at 12:22




                                                          This should be accepted as answer
                                                          – andrey.shedko
                                                          Nov 21 at 12:22










                                                          up vote
                                                          46
                                                          down vote













                                                          On Mac OS X you need the following command:



                                                          sudo lsof -t -i tcp:4200 | xargs kill -9



                                                          Remember you need to kill Angular's web server with Command+C.






                                                          share|improve this answer

























                                                            up vote
                                                            46
                                                            down vote













                                                            On Mac OS X you need the following command:



                                                            sudo lsof -t -i tcp:4200 | xargs kill -9



                                                            Remember you need to kill Angular's web server with Command+C.






                                                            share|improve this answer























                                                              up vote
                                                              46
                                                              down vote










                                                              up vote
                                                              46
                                                              down vote









                                                              On Mac OS X you need the following command:



                                                              sudo lsof -t -i tcp:4200 | xargs kill -9



                                                              Remember you need to kill Angular's web server with Command+C.






                                                              share|improve this answer












                                                              On Mac OS X you need the following command:



                                                              sudo lsof -t -i tcp:4200 | xargs kill -9



                                                              Remember you need to kill Angular's web server with Command+C.







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered Jun 20 '17 at 20:32









                                                              Julian Fraser

                                                              60045




                                                              60045






















                                                                  up vote
                                                                  9
                                                                  down vote













                                                                  Not ctrl+Z,
                                                                  you must run for stop ctrl+C
                                                                  it's worked, I checking






                                                                  share|improve this answer























                                                                  • by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                    – Flo
                                                                    Nov 21 at 9:04















                                                                  up vote
                                                                  9
                                                                  down vote













                                                                  Not ctrl+Z,
                                                                  you must run for stop ctrl+C
                                                                  it's worked, I checking






                                                                  share|improve this answer























                                                                  • by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                    – Flo
                                                                    Nov 21 at 9:04













                                                                  up vote
                                                                  9
                                                                  down vote










                                                                  up vote
                                                                  9
                                                                  down vote









                                                                  Not ctrl+Z,
                                                                  you must run for stop ctrl+C
                                                                  it's worked, I checking






                                                                  share|improve this answer














                                                                  Not ctrl+Z,
                                                                  you must run for stop ctrl+C
                                                                  it's worked, I checking







                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited Sep 24 at 5:16









                                                                  Rohit Sharma

                                                                  2,21521027




                                                                  2,21521027










                                                                  answered Nov 7 '16 at 10:38









                                                                  Emir Mamashov

                                                                  25136




                                                                  25136












                                                                  • by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                    – Flo
                                                                    Nov 21 at 9:04


















                                                                  • by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                    – Flo
                                                                    Nov 21 at 9:04
















                                                                  by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                  – Flo
                                                                  Nov 21 at 9:04




                                                                  by far the simplest solution to the problem, even if technically it does not respond to the OP question
                                                                  – Flo
                                                                  Nov 21 at 9:04










                                                                  up vote
                                                                  8
                                                                  down vote













                                                                  Use this command to kill ng:



                                                                  pkill -9 ng





                                                                  share|improve this answer

























                                                                    up vote
                                                                    8
                                                                    down vote













                                                                    Use this command to kill ng:



                                                                    pkill -9 ng





                                                                    share|improve this answer























                                                                      up vote
                                                                      8
                                                                      down vote










                                                                      up vote
                                                                      8
                                                                      down vote









                                                                      Use this command to kill ng:



                                                                      pkill -9 ng





                                                                      share|improve this answer












                                                                      Use this command to kill ng:



                                                                      pkill -9 ng






                                                                      share|improve this answer












                                                                      share|improve this answer



                                                                      share|improve this answer










                                                                      answered Jun 12 at 17:13









                                                                      Lolita

                                                                      8111




                                                                      8111






















                                                                          up vote
                                                                          8
                                                                          down vote













                                                                          ng serve --port <YOUR_GIVEN_PORT_NUMBER>



                                                                          You should try above command to run on your given port.






                                                                          share|improve this answer

























                                                                            up vote
                                                                            8
                                                                            down vote













                                                                            ng serve --port <YOUR_GIVEN_PORT_NUMBER>



                                                                            You should try above command to run on your given port.






                                                                            share|improve this answer























                                                                              up vote
                                                                              8
                                                                              down vote










                                                                              up vote
                                                                              8
                                                                              down vote









                                                                              ng serve --port <YOUR_GIVEN_PORT_NUMBER>



                                                                              You should try above command to run on your given port.






                                                                              share|improve this answer












                                                                              ng serve --port <YOUR_GIVEN_PORT_NUMBER>



                                                                              You should try above command to run on your given port.







                                                                              share|improve this answer












                                                                              share|improve this answer



                                                                              share|improve this answer










                                                                              answered Jul 5 at 8:07









                                                                              Shubham Verma

                                                                              2,29712449




                                                                              2,29712449






















                                                                                  up vote
                                                                                  7
                                                                                  down vote













                                                                                  I also faced the same error msg, so i tried ng serve --port 12012 and it worked fine.






                                                                                  share|improve this answer

















                                                                                  • 5




                                                                                    we cannot alot new port everytime.
                                                                                    – shijin
                                                                                    Jun 20 '17 at 13:09






                                                                                  • 7




                                                                                    Who is upvoting answers like these?
                                                                                    – shark1608
                                                                                    Nov 10 '17 at 17:55















                                                                                  up vote
                                                                                  7
                                                                                  down vote













                                                                                  I also faced the same error msg, so i tried ng serve --port 12012 and it worked fine.






                                                                                  share|improve this answer

















                                                                                  • 5




                                                                                    we cannot alot new port everytime.
                                                                                    – shijin
                                                                                    Jun 20 '17 at 13:09






                                                                                  • 7




                                                                                    Who is upvoting answers like these?
                                                                                    – shark1608
                                                                                    Nov 10 '17 at 17:55













                                                                                  up vote
                                                                                  7
                                                                                  down vote










                                                                                  up vote
                                                                                  7
                                                                                  down vote









                                                                                  I also faced the same error msg, so i tried ng serve --port 12012 and it worked fine.






                                                                                  share|improve this answer












                                                                                  I also faced the same error msg, so i tried ng serve --port 12012 and it worked fine.







                                                                                  share|improve this answer












                                                                                  share|improve this answer



                                                                                  share|improve this answer










                                                                                  answered Dec 10 '16 at 7:48









                                                                                  Sachin Gaikwad

                                                                                  32529




                                                                                  32529








                                                                                  • 5




                                                                                    we cannot alot new port everytime.
                                                                                    – shijin
                                                                                    Jun 20 '17 at 13:09






                                                                                  • 7




                                                                                    Who is upvoting answers like these?
                                                                                    – shark1608
                                                                                    Nov 10 '17 at 17:55














                                                                                  • 5




                                                                                    we cannot alot new port everytime.
                                                                                    – shijin
                                                                                    Jun 20 '17 at 13:09






                                                                                  • 7




                                                                                    Who is upvoting answers like these?
                                                                                    – shark1608
                                                                                    Nov 10 '17 at 17:55








                                                                                  5




                                                                                  5




                                                                                  we cannot alot new port everytime.
                                                                                  – shijin
                                                                                  Jun 20 '17 at 13:09




                                                                                  we cannot alot new port everytime.
                                                                                  – shijin
                                                                                  Jun 20 '17 at 13:09




                                                                                  7




                                                                                  7




                                                                                  Who is upvoting answers like these?
                                                                                  – shark1608
                                                                                  Nov 10 '17 at 17:55




                                                                                  Who is upvoting answers like these?
                                                                                  – shark1608
                                                                                  Nov 10 '17 at 17:55










                                                                                  up vote
                                                                                  6
                                                                                  down vote













                                                                                  When you use Ctrl+Z, you are going to suspend a running task but not to kill it. You can later use command fg to resume the task.
                                                                                  If you want to quit ng serve, you should use Ctrl+C instead, in which will also release the 4200 port.






                                                                                  share|improve this answer

























                                                                                    up vote
                                                                                    6
                                                                                    down vote













                                                                                    When you use Ctrl+Z, you are going to suspend a running task but not to kill it. You can later use command fg to resume the task.
                                                                                    If you want to quit ng serve, you should use Ctrl+C instead, in which will also release the 4200 port.






                                                                                    share|improve this answer























                                                                                      up vote
                                                                                      6
                                                                                      down vote










                                                                                      up vote
                                                                                      6
                                                                                      down vote









                                                                                      When you use Ctrl+Z, you are going to suspend a running task but not to kill it. You can later use command fg to resume the task.
                                                                                      If you want to quit ng serve, you should use Ctrl+C instead, in which will also release the 4200 port.






                                                                                      share|improve this answer












                                                                                      When you use Ctrl+Z, you are going to suspend a running task but not to kill it. You can later use command fg to resume the task.
                                                                                      If you want to quit ng serve, you should use Ctrl+C instead, in which will also release the 4200 port.







                                                                                      share|improve this answer












                                                                                      share|improve this answer



                                                                                      share|improve this answer










                                                                                      answered Oct 3 '17 at 17:01









                                                                                      Roman Lo

                                                                                      6112




                                                                                      6112






















                                                                                          up vote
                                                                                          5
                                                                                          down vote













                                                                                          We can forcefully kill the port by following command.



                                                                                          kill -2 $(lsof -t -i:4200)





                                                                                          share|improve this answer



























                                                                                            up vote
                                                                                            5
                                                                                            down vote













                                                                                            We can forcefully kill the port by following command.



                                                                                            kill -2 $(lsof -t -i:4200)





                                                                                            share|improve this answer

























                                                                                              up vote
                                                                                              5
                                                                                              down vote










                                                                                              up vote
                                                                                              5
                                                                                              down vote









                                                                                              We can forcefully kill the port by following command.



                                                                                              kill -2 $(lsof -t -i:4200)





                                                                                              share|improve this answer














                                                                                              We can forcefully kill the port by following command.



                                                                                              kill -2 $(lsof -t -i:4200)






                                                                                              share|improve this answer














                                                                                              share|improve this answer



                                                                                              share|improve this answer








                                                                                              edited Jul 30 '17 at 0:01









                                                                                              Stephen Rauch

                                                                                              27.4k153156




                                                                                              27.4k153156










                                                                                              answered Jul 29 '17 at 23:37









                                                                                              sharath parupati

                                                                                              5111




                                                                                              5111






















                                                                                                  up vote
                                                                                                  4
                                                                                                  down vote













                                                                                                  ng serve --port 4201 --live-reload-port 4200


                                                                                                  and access using localhost:4201



                                                                                                  This should work as a temporary solution.



                                                                                                  or



                                                                                                  try listing port usage using
                                                                                                  lsof -i:4200

                                                                                                  and kill it manually using
                                                                                                  sudo kill -9 <Process PID using port 4200>






                                                                                                  share|improve this answer



























                                                                                                    up vote
                                                                                                    4
                                                                                                    down vote













                                                                                                    ng serve --port 4201 --live-reload-port 4200


                                                                                                    and access using localhost:4201



                                                                                                    This should work as a temporary solution.



                                                                                                    or



                                                                                                    try listing port usage using
                                                                                                    lsof -i:4200

                                                                                                    and kill it manually using
                                                                                                    sudo kill -9 <Process PID using port 4200>






                                                                                                    share|improve this answer

























                                                                                                      up vote
                                                                                                      4
                                                                                                      down vote










                                                                                                      up vote
                                                                                                      4
                                                                                                      down vote









                                                                                                      ng serve --port 4201 --live-reload-port 4200


                                                                                                      and access using localhost:4201



                                                                                                      This should work as a temporary solution.



                                                                                                      or



                                                                                                      try listing port usage using
                                                                                                      lsof -i:4200

                                                                                                      and kill it manually using
                                                                                                      sudo kill -9 <Process PID using port 4200>






                                                                                                      share|improve this answer














                                                                                                      ng serve --port 4201 --live-reload-port 4200


                                                                                                      and access using localhost:4201



                                                                                                      This should work as a temporary solution.



                                                                                                      or



                                                                                                      try listing port usage using
                                                                                                      lsof -i:4200

                                                                                                      and kill it manually using
                                                                                                      sudo kill -9 <Process PID using port 4200>







                                                                                                      share|improve this answer














                                                                                                      share|improve this answer



                                                                                                      share|improve this answer








                                                                                                      edited Jan 22 at 6:26

























                                                                                                      answered Jun 21 '17 at 6:21









                                                                                                      shijin

                                                                                                      1,47911218




                                                                                                      1,47911218






















                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote













                                                                                                          For Windows:



                                                                                                          Open Command Prompt and



                                                                                                          type: netstat -a -o -n



                                                                                                          Find the PID of the process that you want to kill.



                                                                                                          Type: taskkill /F /PID 16876



                                                                                                          This one 16876 - is the PID for the process that I want to kill - in that case, the process is 4200 - check the attached file.you can give any port number.



                                                                                                          enter image description here



                                                                                                          Now, Type : ng serve to start your angular app at the same port 4200






                                                                                                          share|improve this answer



























                                                                                                            up vote
                                                                                                            3
                                                                                                            down vote













                                                                                                            For Windows:



                                                                                                            Open Command Prompt and



                                                                                                            type: netstat -a -o -n



                                                                                                            Find the PID of the process that you want to kill.



                                                                                                            Type: taskkill /F /PID 16876



                                                                                                            This one 16876 - is the PID for the process that I want to kill - in that case, the process is 4200 - check the attached file.you can give any port number.



                                                                                                            enter image description here



                                                                                                            Now, Type : ng serve to start your angular app at the same port 4200






                                                                                                            share|improve this answer

























                                                                                                              up vote
                                                                                                              3
                                                                                                              down vote










                                                                                                              up vote
                                                                                                              3
                                                                                                              down vote









                                                                                                              For Windows:



                                                                                                              Open Command Prompt and



                                                                                                              type: netstat -a -o -n



                                                                                                              Find the PID of the process that you want to kill.



                                                                                                              Type: taskkill /F /PID 16876



                                                                                                              This one 16876 - is the PID for the process that I want to kill - in that case, the process is 4200 - check the attached file.you can give any port number.



                                                                                                              enter image description here



                                                                                                              Now, Type : ng serve to start your angular app at the same port 4200






                                                                                                              share|improve this answer














                                                                                                              For Windows:



                                                                                                              Open Command Prompt and



                                                                                                              type: netstat -a -o -n



                                                                                                              Find the PID of the process that you want to kill.



                                                                                                              Type: taskkill /F /PID 16876



                                                                                                              This one 16876 - is the PID for the process that I want to kill - in that case, the process is 4200 - check the attached file.you can give any port number.



                                                                                                              enter image description here



                                                                                                              Now, Type : ng serve to start your angular app at the same port 4200







                                                                                                              share|improve this answer














                                                                                                              share|improve this answer



                                                                                                              share|improve this answer








                                                                                                              edited Feb 14 at 10:52

























                                                                                                              answered Feb 14 at 10:42









                                                                                                              Jay Kareliya

                                                                                                              455419




                                                                                                              455419






















                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote













                                                                                                                  netstat -anp | grep ":4200"


                                                                                                                  This will tell you who's got the port.






                                                                                                                  share|improve this answer





















                                                                                                                  • is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                    – peztherez
                                                                                                                    Aug 23 '16 at 3:38












                                                                                                                  • Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                    – Joshua
                                                                                                                    Aug 23 '16 at 21:26















                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote













                                                                                                                  netstat -anp | grep ":4200"


                                                                                                                  This will tell you who's got the port.






                                                                                                                  share|improve this answer





















                                                                                                                  • is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                    – peztherez
                                                                                                                    Aug 23 '16 at 3:38












                                                                                                                  • Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                    – Joshua
                                                                                                                    Aug 23 '16 at 21:26













                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote










                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote









                                                                                                                  netstat -anp | grep ":4200"


                                                                                                                  This will tell you who's got the port.






                                                                                                                  share|improve this answer












                                                                                                                  netstat -anp | grep ":4200"


                                                                                                                  This will tell you who's got the port.







                                                                                                                  share|improve this answer












                                                                                                                  share|improve this answer



                                                                                                                  share|improve this answer










                                                                                                                  answered Aug 23 '16 at 3:26









                                                                                                                  Joshua

                                                                                                                  22.8k54798




                                                                                                                  22.8k54798












                                                                                                                  • is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                    – peztherez
                                                                                                                    Aug 23 '16 at 3:38












                                                                                                                  • Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                    – Joshua
                                                                                                                    Aug 23 '16 at 21:26


















                                                                                                                  • is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                    – peztherez
                                                                                                                    Aug 23 '16 at 3:38












                                                                                                                  • Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                    – Joshua
                                                                                                                    Aug 23 '16 at 21:26
















                                                                                                                  is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                  – peztherez
                                                                                                                  Aug 23 '16 at 3:38






                                                                                                                  is it - anp ? that returned nothing so I just added a space because your command was asking for "nestat: option requires an argument --p "
                                                                                                                  – peztherez
                                                                                                                  Aug 23 '16 at 3:38














                                                                                                                  Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                  – Joshua
                                                                                                                  Aug 23 '16 at 21:26




                                                                                                                  Your netstat must be different from mine. Maybe add an OS tag.
                                                                                                                  – Joshua
                                                                                                                  Aug 23 '16 at 21:26










                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote













                                                                                                                  The most simple one line command:



                                                                                                                   sudo fuser -k 4200/tcp





                                                                                                                  share|improve this answer

























                                                                                                                    up vote
                                                                                                                    2
                                                                                                                    down vote













                                                                                                                    The most simple one line command:



                                                                                                                     sudo fuser -k 4200/tcp





                                                                                                                    share|improve this answer























                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote










                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote









                                                                                                                      The most simple one line command:



                                                                                                                       sudo fuser -k 4200/tcp





                                                                                                                      share|improve this answer












                                                                                                                      The most simple one line command:



                                                                                                                       sudo fuser -k 4200/tcp






                                                                                                                      share|improve this answer












                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer










                                                                                                                      answered Jan 8 at 6:55









                                                                                                                      Salman Ahmed

                                                                                                                      151311




                                                                                                                      151311






















                                                                                                                          up vote
                                                                                                                          1
                                                                                                                          down vote













                                                                                                                          You can also try with this to run your application in visual studio code -:



                                                                                                                          ng serve --open --port 4201


                                                                                                                          you can give any port number.






                                                                                                                          share|improve this answer

























                                                                                                                            up vote
                                                                                                                            1
                                                                                                                            down vote













                                                                                                                            You can also try with this to run your application in visual studio code -:



                                                                                                                            ng serve --open --port 4201


                                                                                                                            you can give any port number.






                                                                                                                            share|improve this answer























                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote










                                                                                                                              up vote
                                                                                                                              1
                                                                                                                              down vote









                                                                                                                              You can also try with this to run your application in visual studio code -:



                                                                                                                              ng serve --open --port 4201


                                                                                                                              you can give any port number.






                                                                                                                              share|improve this answer












                                                                                                                              You can also try with this to run your application in visual studio code -:



                                                                                                                              ng serve --open --port 4201


                                                                                                                              you can give any port number.







                                                                                                                              share|improve this answer












                                                                                                                              share|improve this answer



                                                                                                                              share|improve this answer










                                                                                                                              answered Jan 4 at 6:54









                                                                                                                              HarmesH KaushiK

                                                                                                                              112




                                                                                                                              112






















                                                                                                                                  up vote
                                                                                                                                  1
                                                                                                                                  down vote













                                                                                                                                  you can use fuser -k 4200/tcp if it is Linux Operating system






                                                                                                                                  share|improve this answer

























                                                                                                                                    up vote
                                                                                                                                    1
                                                                                                                                    down vote













                                                                                                                                    you can use fuser -k 4200/tcp if it is Linux Operating system






                                                                                                                                    share|improve this answer























                                                                                                                                      up vote
                                                                                                                                      1
                                                                                                                                      down vote










                                                                                                                                      up vote
                                                                                                                                      1
                                                                                                                                      down vote









                                                                                                                                      you can use fuser -k 4200/tcp if it is Linux Operating system






                                                                                                                                      share|improve this answer












                                                                                                                                      you can use fuser -k 4200/tcp if it is Linux Operating system







                                                                                                                                      share|improve this answer












                                                                                                                                      share|improve this answer



                                                                                                                                      share|improve this answer










                                                                                                                                      answered Apr 22 at 11:39









                                                                                                                                      Machhindra Neupane

                                                                                                                                      360210




                                                                                                                                      360210






















                                                                                                                                          up vote
                                                                                                                                          1
                                                                                                                                          down vote













                                                                                                                                          Kill process and close the terminal which you used for running the app on that port.






                                                                                                                                          share|improve this answer

























                                                                                                                                            up vote
                                                                                                                                            1
                                                                                                                                            down vote













                                                                                                                                            Kill process and close the terminal which you used for running the app on that port.






                                                                                                                                            share|improve this answer























                                                                                                                                              up vote
                                                                                                                                              1
                                                                                                                                              down vote










                                                                                                                                              up vote
                                                                                                                                              1
                                                                                                                                              down vote









                                                                                                                                              Kill process and close the terminal which you used for running the app on that port.






                                                                                                                                              share|improve this answer












                                                                                                                                              Kill process and close the terminal which you used for running the app on that port.







                                                                                                                                              share|improve this answer












                                                                                                                                              share|improve this answer



                                                                                                                                              share|improve this answer










                                                                                                                                              answered May 8 at 13:06









                                                                                                                                              Gjorgi Gjorgiev

                                                                                                                                              514




                                                                                                                                              514






















                                                                                                                                                  up vote
                                                                                                                                                  1
                                                                                                                                                  down vote













                                                                                                                                                  Instead of killing the whole process or using ctrl+z, you can simply use ctrl+c to stop the server and can happily use ng serve command without any errors or if you want to run on a different port simply use this command ng serve --port portno(ex: ng serve --port 4201).






                                                                                                                                                  share|improve this answer



























                                                                                                                                                    up vote
                                                                                                                                                    1
                                                                                                                                                    down vote













                                                                                                                                                    Instead of killing the whole process or using ctrl+z, you can simply use ctrl+c to stop the server and can happily use ng serve command without any errors or if you want to run on a different port simply use this command ng serve --port portno(ex: ng serve --port 4201).






                                                                                                                                                    share|improve this answer

























                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote










                                                                                                                                                      up vote
                                                                                                                                                      1
                                                                                                                                                      down vote









                                                                                                                                                      Instead of killing the whole process or using ctrl+z, you can simply use ctrl+c to stop the server and can happily use ng serve command without any errors or if you want to run on a different port simply use this command ng serve --port portno(ex: ng serve --port 4201).






                                                                                                                                                      share|improve this answer














                                                                                                                                                      Instead of killing the whole process or using ctrl+z, you can simply use ctrl+c to stop the server and can happily use ng serve command without any errors or if you want to run on a different port simply use this command ng serve --port portno(ex: ng serve --port 4201).







                                                                                                                                                      share|improve this answer














                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer








                                                                                                                                                      edited Aug 23 at 9:46

























                                                                                                                                                      answered Apr 2 at 4:21









                                                                                                                                                      Alekya

                                                                                                                                                      11910




                                                                                                                                                      11910






















                                                                                                                                                          up vote
                                                                                                                                                          1
                                                                                                                                                          down vote













                                                                                                                                                          With ctrl + z you put the program in the background.
                                                                                                                                                          On Linux you can get the session back in the foreground with the following command:



                                                                                                                                                          fg ng serve



                                                                                                                                                          You don't need to kill the process.






                                                                                                                                                          share|improve this answer

























                                                                                                                                                            up vote
                                                                                                                                                            1
                                                                                                                                                            down vote













                                                                                                                                                            With ctrl + z you put the program in the background.
                                                                                                                                                            On Linux you can get the session back in the foreground with the following command:



                                                                                                                                                            fg ng serve



                                                                                                                                                            You don't need to kill the process.






                                                                                                                                                            share|improve this answer























                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote










                                                                                                                                                              up vote
                                                                                                                                                              1
                                                                                                                                                              down vote









                                                                                                                                                              With ctrl + z you put the program in the background.
                                                                                                                                                              On Linux you can get the session back in the foreground with the following command:



                                                                                                                                                              fg ng serve



                                                                                                                                                              You don't need to kill the process.






                                                                                                                                                              share|improve this answer












                                                                                                                                                              With ctrl + z you put the program in the background.
                                                                                                                                                              On Linux you can get the session back in the foreground with the following command:



                                                                                                                                                              fg ng serve



                                                                                                                                                              You don't need to kill the process.







                                                                                                                                                              share|improve this answer












                                                                                                                                                              share|improve this answer



                                                                                                                                                              share|improve this answer










                                                                                                                                                              answered Nov 14 at 11:42









                                                                                                                                                              Spirit

                                                                                                                                                              657




                                                                                                                                                              657






















                                                                                                                                                                  up vote
                                                                                                                                                                  0
                                                                                                                                                                  down vote













                                                                                                                                                                  If you compiling your angular JS code in both CMD and IDE then this issue occur. In CMD, your angular JS code compile automatically whenever you change your angular JS code in IDE and then your IDE want to occupy the same port i.e 4200 which is occupied by CMD already
                                                                                                                                                                  So, there is a simple solution for this issue, just close your cmd while compiling your code in IDE.






                                                                                                                                                                  share|improve this answer

























                                                                                                                                                                    up vote
                                                                                                                                                                    0
                                                                                                                                                                    down vote













                                                                                                                                                                    If you compiling your angular JS code in both CMD and IDE then this issue occur. In CMD, your angular JS code compile automatically whenever you change your angular JS code in IDE and then your IDE want to occupy the same port i.e 4200 which is occupied by CMD already
                                                                                                                                                                    So, there is a simple solution for this issue, just close your cmd while compiling your code in IDE.






                                                                                                                                                                    share|improve this answer























                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote










                                                                                                                                                                      up vote
                                                                                                                                                                      0
                                                                                                                                                                      down vote









                                                                                                                                                                      If you compiling your angular JS code in both CMD and IDE then this issue occur. In CMD, your angular JS code compile automatically whenever you change your angular JS code in IDE and then your IDE want to occupy the same port i.e 4200 which is occupied by CMD already
                                                                                                                                                                      So, there is a simple solution for this issue, just close your cmd while compiling your code in IDE.






                                                                                                                                                                      share|improve this answer












                                                                                                                                                                      If you compiling your angular JS code in both CMD and IDE then this issue occur. In CMD, your angular JS code compile automatically whenever you change your angular JS code in IDE and then your IDE want to occupy the same port i.e 4200 which is occupied by CMD already
                                                                                                                                                                      So, there is a simple solution for this issue, just close your cmd while compiling your code in IDE.







                                                                                                                                                                      share|improve this answer












                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer










                                                                                                                                                                      answered Aug 9 '17 at 18:24









                                                                                                                                                                      vishal

                                                                                                                                                                      1




                                                                                                                                                                      1






















                                                                                                                                                                          up vote
                                                                                                                                                                          0
                                                                                                                                                                          down vote













                                                                                                                                                                          I was facing the same issue every time I have to kill the port.



                                                                                                                                                                          I tried ./node_modules/.bin/ng serve --proxy-config proxy.conf.json --host 0.0.0.0 Instead of npm start and its works






                                                                                                                                                                          share|improve this answer

























                                                                                                                                                                            up vote
                                                                                                                                                                            0
                                                                                                                                                                            down vote













                                                                                                                                                                            I was facing the same issue every time I have to kill the port.



                                                                                                                                                                            I tried ./node_modules/.bin/ng serve --proxy-config proxy.conf.json --host 0.0.0.0 Instead of npm start and its works






                                                                                                                                                                            share|improve this answer























                                                                                                                                                                              up vote
                                                                                                                                                                              0
                                                                                                                                                                              down vote










                                                                                                                                                                              up vote
                                                                                                                                                                              0
                                                                                                                                                                              down vote









                                                                                                                                                                              I was facing the same issue every time I have to kill the port.



                                                                                                                                                                              I tried ./node_modules/.bin/ng serve --proxy-config proxy.conf.json --host 0.0.0.0 Instead of npm start and its works






                                                                                                                                                                              share|improve this answer












                                                                                                                                                                              I was facing the same issue every time I have to kill the port.



                                                                                                                                                                              I tried ./node_modules/.bin/ng serve --proxy-config proxy.conf.json --host 0.0.0.0 Instead of npm start and its works







                                                                                                                                                                              share|improve this answer












                                                                                                                                                                              share|improve this answer



                                                                                                                                                                              share|improve this answer










                                                                                                                                                                              answered Oct 24 '17 at 6:39









                                                                                                                                                                              Ismail Farooq

                                                                                                                                                                              3,81211534




                                                                                                                                                                              3,81211534






















                                                                                                                                                                                  up vote
                                                                                                                                                                                  0
                                                                                                                                                                                  down vote













                                                                                                                                                                                  On linux mint 17, this is working.



                                                                                                                                                                                  kill -9 $(lsof -t -i:4200)






                                                                                                                                                                                  share|improve this answer

























                                                                                                                                                                                    up vote
                                                                                                                                                                                    0
                                                                                                                                                                                    down vote













                                                                                                                                                                                    On linux mint 17, this is working.



                                                                                                                                                                                    kill -9 $(lsof -t -i:4200)






                                                                                                                                                                                    share|improve this answer























                                                                                                                                                                                      up vote
                                                                                                                                                                                      0
                                                                                                                                                                                      down vote










                                                                                                                                                                                      up vote
                                                                                                                                                                                      0
                                                                                                                                                                                      down vote









                                                                                                                                                                                      On linux mint 17, this is working.



                                                                                                                                                                                      kill -9 $(lsof -t -i:4200)






                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                      On linux mint 17, this is working.



                                                                                                                                                                                      kill -9 $(lsof -t -i:4200)







                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                      answered Feb 19 at 13:41









                                                                                                                                                                                      zerre

                                                                                                                                                                                      268




                                                                                                                                                                                      268






















                                                                                                                                                                                          up vote
                                                                                                                                                                                          0
                                                                                                                                                                                          down vote













                                                                                                                                                                                          It is possible to change port in .angular-cli file. For example:



                                                                                                                                                                                          "defaults": {
                                                                                                                                                                                          "styleExt": "css",
                                                                                                                                                                                          "component": {},
                                                                                                                                                                                          "serve": {
                                                                                                                                                                                          "port": 4205
                                                                                                                                                                                          }
                                                                                                                                                                                          }


                                                                                                                                                                                          In addition, it is necessary to add this to your package.json:



                                                                                                                                                                                          "ng": "ng",
                                                                                                                                                                                          "start": "ng serve"





                                                                                                                                                                                          share|improve this answer

























                                                                                                                                                                                            up vote
                                                                                                                                                                                            0
                                                                                                                                                                                            down vote













                                                                                                                                                                                            It is possible to change port in .angular-cli file. For example:



                                                                                                                                                                                            "defaults": {
                                                                                                                                                                                            "styleExt": "css",
                                                                                                                                                                                            "component": {},
                                                                                                                                                                                            "serve": {
                                                                                                                                                                                            "port": 4205
                                                                                                                                                                                            }
                                                                                                                                                                                            }


                                                                                                                                                                                            In addition, it is necessary to add this to your package.json:



                                                                                                                                                                                            "ng": "ng",
                                                                                                                                                                                            "start": "ng serve"





                                                                                                                                                                                            share|improve this answer























                                                                                                                                                                                              up vote
                                                                                                                                                                                              0
                                                                                                                                                                                              down vote










                                                                                                                                                                                              up vote
                                                                                                                                                                                              0
                                                                                                                                                                                              down vote









                                                                                                                                                                                              It is possible to change port in .angular-cli file. For example:



                                                                                                                                                                                              "defaults": {
                                                                                                                                                                                              "styleExt": "css",
                                                                                                                                                                                              "component": {},
                                                                                                                                                                                              "serve": {
                                                                                                                                                                                              "port": 4205
                                                                                                                                                                                              }
                                                                                                                                                                                              }


                                                                                                                                                                                              In addition, it is necessary to add this to your package.json:



                                                                                                                                                                                              "ng": "ng",
                                                                                                                                                                                              "start": "ng serve"





                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                              It is possible to change port in .angular-cli file. For example:



                                                                                                                                                                                              "defaults": {
                                                                                                                                                                                              "styleExt": "css",
                                                                                                                                                                                              "component": {},
                                                                                                                                                                                              "serve": {
                                                                                                                                                                                              "port": 4205
                                                                                                                                                                                              }
                                                                                                                                                                                              }


                                                                                                                                                                                              In addition, it is necessary to add this to your package.json:



                                                                                                                                                                                              "ng": "ng",
                                                                                                                                                                                              "start": "ng serve"






                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                              share|improve this answer










                                                                                                                                                                                              answered Mar 6 at 11:11









                                                                                                                                                                                              StepUp

                                                                                                                                                                                              6,68774472




                                                                                                                                                                                              6,68774472






















                                                                                                                                                                                                  up vote
                                                                                                                                                                                                  0
                                                                                                                                                                                                  down vote













                                                                                                                                                                                                  It says already we are running the services with port no 4200 please use another port instead of 4200. Below command is to solve the problem




                                                                                                                                                                                                  ng serve --port 4300







                                                                                                                                                                                                  share|improve this answer



























                                                                                                                                                                                                    up vote
                                                                                                                                                                                                    0
                                                                                                                                                                                                    down vote













                                                                                                                                                                                                    It says already we are running the services with port no 4200 please use another port instead of 4200. Below command is to solve the problem




                                                                                                                                                                                                    ng serve --port 4300







                                                                                                                                                                                                    share|improve this answer

























                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote










                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      0
                                                                                                                                                                                                      down vote









                                                                                                                                                                                                      It says already we are running the services with port no 4200 please use another port instead of 4200. Below command is to solve the problem




                                                                                                                                                                                                      ng serve --port 4300







                                                                                                                                                                                                      share|improve this answer














                                                                                                                                                                                                      It says already we are running the services with port no 4200 please use another port instead of 4200. Below command is to solve the problem




                                                                                                                                                                                                      ng serve --port 4300








                                                                                                                                                                                                      share|improve this answer














                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                      share|improve this answer








                                                                                                                                                                                                      edited Mar 19 at 9:17









                                                                                                                                                                                                      rollstuhlfahrer

                                                                                                                                                                                                      3,24781831




                                                                                                                                                                                                      3,24781831










                                                                                                                                                                                                      answered Mar 19 at 9:01









                                                                                                                                                                                                      dharma rao Palli

                                                                                                                                                                                                      92




                                                                                                                                                                                                      92






















                                                                                                                                                                                                          up vote
                                                                                                                                                                                                          0
                                                                                                                                                                                                          down vote













                                                                                                                                                                                                          Port 4200 is already in use. Use '--port' to specify a different port


                                                                                                                                                                                                          This means that you already have another service running on port 4200. If this is the case
                                                                                                                                                                                                          you can either . shut down the other service. use the --port flag when running ng
                                                                                                                                                                                                          serve like this:



                                                                                                                                                                                                           ng serve --port 9001


                                                                                                                                                                                                          Another thing to notice is that, on some machines, the domain localhost may not work.
                                                                                                                                                                                                          You may see a set of numbers such as 127.0.0.1. When you run ng serve it should show
                                                                                                                                                                                                          you what URL the server is running on, so be sure to read the messages on your machine
                                                                                                                                                                                                          to find your exact development URL.






                                                                                                                                                                                                          share|improve this answer

























                                                                                                                                                                                                            up vote
                                                                                                                                                                                                            0
                                                                                                                                                                                                            down vote













                                                                                                                                                                                                            Port 4200 is already in use. Use '--port' to specify a different port


                                                                                                                                                                                                            This means that you already have another service running on port 4200. If this is the case
                                                                                                                                                                                                            you can either . shut down the other service. use the --port flag when running ng
                                                                                                                                                                                                            serve like this:



                                                                                                                                                                                                             ng serve --port 9001


                                                                                                                                                                                                            Another thing to notice is that, on some machines, the domain localhost may not work.
                                                                                                                                                                                                            You may see a set of numbers such as 127.0.0.1. When you run ng serve it should show
                                                                                                                                                                                                            you what URL the server is running on, so be sure to read the messages on your machine
                                                                                                                                                                                                            to find your exact development URL.






                                                                                                                                                                                                            share|improve this answer























                                                                                                                                                                                                              up vote
                                                                                                                                                                                                              0
                                                                                                                                                                                                              down vote










                                                                                                                                                                                                              up vote
                                                                                                                                                                                                              0
                                                                                                                                                                                                              down vote









                                                                                                                                                                                                              Port 4200 is already in use. Use '--port' to specify a different port


                                                                                                                                                                                                              This means that you already have another service running on port 4200. If this is the case
                                                                                                                                                                                                              you can either . shut down the other service. use the --port flag when running ng
                                                                                                                                                                                                              serve like this:



                                                                                                                                                                                                               ng serve --port 9001


                                                                                                                                                                                                              Another thing to notice is that, on some machines, the domain localhost may not work.
                                                                                                                                                                                                              You may see a set of numbers such as 127.0.0.1. When you run ng serve it should show
                                                                                                                                                                                                              you what URL the server is running on, so be sure to read the messages on your machine
                                                                                                                                                                                                              to find your exact development URL.






                                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                                              Port 4200 is already in use. Use '--port' to specify a different port


                                                                                                                                                                                                              This means that you already have another service running on port 4200. If this is the case
                                                                                                                                                                                                              you can either . shut down the other service. use the --port flag when running ng
                                                                                                                                                                                                              serve like this:



                                                                                                                                                                                                               ng serve --port 9001


                                                                                                                                                                                                              Another thing to notice is that, on some machines, the domain localhost may not work.
                                                                                                                                                                                                              You may see a set of numbers such as 127.0.0.1. When you run ng serve it should show
                                                                                                                                                                                                              you what URL the server is running on, so be sure to read the messages on your machine
                                                                                                                                                                                                              to find your exact development URL.







                                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                                              share|improve this answer










                                                                                                                                                                                                              answered Apr 22 at 10:31









                                                                                                                                                                                                              Mohammad Daliri

                                                                                                                                                                                                              439616




                                                                                                                                                                                                              439616






















                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote













                                                                                                                                                                                                                  netstat -plnet



                                                                                                                                                                                                                  tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN 1001 63955 7077/ng



                                                                                                                                                                                                                  kill -9 7077



                                                                                                                                                                                                                  again start your ng serve.






                                                                                                                                                                                                                  share|improve this answer

















                                                                                                                                                                                                                  • 1




                                                                                                                                                                                                                    While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                    – Filnor
                                                                                                                                                                                                                    Jun 8 at 6:06















                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote













                                                                                                                                                                                                                  netstat -plnet



                                                                                                                                                                                                                  tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN 1001 63955 7077/ng



                                                                                                                                                                                                                  kill -9 7077



                                                                                                                                                                                                                  again start your ng serve.






                                                                                                                                                                                                                  share|improve this answer

















                                                                                                                                                                                                                  • 1




                                                                                                                                                                                                                    While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                    – Filnor
                                                                                                                                                                                                                    Jun 8 at 6:06













                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote










                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote









                                                                                                                                                                                                                  netstat -plnet



                                                                                                                                                                                                                  tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN 1001 63955 7077/ng



                                                                                                                                                                                                                  kill -9 7077



                                                                                                                                                                                                                  again start your ng serve.






                                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                                  netstat -plnet



                                                                                                                                                                                                                  tcp 0 0 127.0.0.1:4200 0.0.0.0:* LISTEN 1001 63955 7077/ng



                                                                                                                                                                                                                  kill -9 7077



                                                                                                                                                                                                                  again start your ng serve.







                                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                                                  answered Jun 8 at 5:53









                                                                                                                                                                                                                  Hacker Jarvis

                                                                                                                                                                                                                  1




                                                                                                                                                                                                                  1








                                                                                                                                                                                                                  • 1




                                                                                                                                                                                                                    While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                    – Filnor
                                                                                                                                                                                                                    Jun 8 at 6:06














                                                                                                                                                                                                                  • 1




                                                                                                                                                                                                                    While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                    – Filnor
                                                                                                                                                                                                                    Jun 8 at 6:06








                                                                                                                                                                                                                  1




                                                                                                                                                                                                                  1




                                                                                                                                                                                                                  While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                  – Filnor
                                                                                                                                                                                                                  Jun 8 at 6:06




                                                                                                                                                                                                                  While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations!
                                                                                                                                                                                                                  – Filnor
                                                                                                                                                                                                                  Jun 8 at 6:06










                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  0
                                                                                                                                                                                                                  down vote













                                                                                                                                                                                                                  In Windows; In command prompt which is running your ng serve just click and press keys:



                                                                                                                                                                                                                  ctrl + c


                                                                                                                                                                                                                  It will ask you: Terminate batch job (Y/N)?
                                                                                                                                                                                                                  and you type Y






                                                                                                                                                                                                                  share|improve this answer

























                                                                                                                                                                                                                    up vote
                                                                                                                                                                                                                    0
                                                                                                                                                                                                                    down vote













                                                                                                                                                                                                                    In Windows; In command prompt which is running your ng serve just click and press keys:



                                                                                                                                                                                                                    ctrl + c


                                                                                                                                                                                                                    It will ask you: Terminate batch job (Y/N)?
                                                                                                                                                                                                                    and you type Y






                                                                                                                                                                                                                    share|improve this answer























                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                      0
                                                                                                                                                                                                                      down vote










                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                      0
                                                                                                                                                                                                                      down vote









                                                                                                                                                                                                                      In Windows; In command prompt which is running your ng serve just click and press keys:



                                                                                                                                                                                                                      ctrl + c


                                                                                                                                                                                                                      It will ask you: Terminate batch job (Y/N)?
                                                                                                                                                                                                                      and you type Y






                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                      In Windows; In command prompt which is running your ng serve just click and press keys:



                                                                                                                                                                                                                      ctrl + c


                                                                                                                                                                                                                      It will ask you: Terminate batch job (Y/N)?
                                                                                                                                                                                                                      and you type Y







                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                                                      answered Jul 2 at 23:52









                                                                                                                                                                                                                      Sharif Yazdian

                                                                                                                                                                                                                      17028




                                                                                                                                                                                                                      17028






















                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                          0
                                                                                                                                                                                                                          down vote













                                                                                                                                                                                                                          As first step after any changes, I use ng build, then ng serve. It works without any problems.






                                                                                                                                                                                                                          share|improve this answer

























                                                                                                                                                                                                                            up vote
                                                                                                                                                                                                                            0
                                                                                                                                                                                                                            down vote













                                                                                                                                                                                                                            As first step after any changes, I use ng build, then ng serve. It works without any problems.






                                                                                                                                                                                                                            share|improve this answer























                                                                                                                                                                                                                              up vote
                                                                                                                                                                                                                              0
                                                                                                                                                                                                                              down vote










                                                                                                                                                                                                                              up vote
                                                                                                                                                                                                                              0
                                                                                                                                                                                                                              down vote









                                                                                                                                                                                                                              As first step after any changes, I use ng build, then ng serve. It works without any problems.






                                                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                                                              As first step after any changes, I use ng build, then ng serve. It works without any problems.







                                                                                                                                                                                                                              share|improve this answer












                                                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                                                              share|improve this answer










                                                                                                                                                                                                                              answered Jul 5 at 8:02









                                                                                                                                                                                                                              Lena Neumann

                                                                                                                                                                                                                              1




                                                                                                                                                                                                                              1






















                                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                                  0
                                                                                                                                                                                                                                  down vote













                                                                                                                                                                                                                                  Just restart the IDE you are using, then it will work.






                                                                                                                                                                                                                                  share|improve this answer

























                                                                                                                                                                                                                                    up vote
                                                                                                                                                                                                                                    0
                                                                                                                                                                                                                                    down vote













                                                                                                                                                                                                                                    Just restart the IDE you are using, then it will work.






                                                                                                                                                                                                                                    share|improve this answer























                                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                                      0
                                                                                                                                                                                                                                      down vote










                                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                                      0
                                                                                                                                                                                                                                      down vote









                                                                                                                                                                                                                                      Just restart the IDE you are using, then it will work.






                                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                                      Just restart the IDE you are using, then it will work.







                                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                                                                      answered Aug 13 at 15:51









                                                                                                                                                                                                                                      aldo

                                                                                                                                                                                                                                      4318




                                                                                                                                                                                                                                      4318






















                                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                                          0
                                                                                                                                                                                                                                          down vote













                                                                                                                                                                                                                                          Only thing that works for me is to restart my system / device...



                                                                                                                                                                                                                                          Using Webstorm IDE by JetBrains.






                                                                                                                                                                                                                                          share|improve this answer



























                                                                                                                                                                                                                                            up vote
                                                                                                                                                                                                                                            0
                                                                                                                                                                                                                                            down vote













                                                                                                                                                                                                                                            Only thing that works for me is to restart my system / device...



                                                                                                                                                                                                                                            Using Webstorm IDE by JetBrains.






                                                                                                                                                                                                                                            share|improve this answer

























                                                                                                                                                                                                                                              up vote
                                                                                                                                                                                                                                              0
                                                                                                                                                                                                                                              down vote










                                                                                                                                                                                                                                              up vote
                                                                                                                                                                                                                                              0
                                                                                                                                                                                                                                              down vote









                                                                                                                                                                                                                                              Only thing that works for me is to restart my system / device...



                                                                                                                                                                                                                                              Using Webstorm IDE by JetBrains.






                                                                                                                                                                                                                                              share|improve this answer














                                                                                                                                                                                                                                              Only thing that works for me is to restart my system / device...



                                                                                                                                                                                                                                              Using Webstorm IDE by JetBrains.







                                                                                                                                                                                                                                              share|improve this answer














                                                                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                                                                              share|improve this answer








                                                                                                                                                                                                                                              edited Aug 14 at 7:01

























                                                                                                                                                                                                                                              answered Aug 2 at 11:12









                                                                                                                                                                                                                                              Rick

                                                                                                                                                                                                                                              67611022




                                                                                                                                                                                                                                              67611022






















                                                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                                                  0
                                                                                                                                                                                                                                                  down vote













                                                                                                                                                                                                                                                  To Access project outside localhost



                                                                                                                                                                                                                                                  Example:



                                                                                                                                                                                                                                                  ng serve --host 192.168.2.2:7006





                                                                                                                                                                                                                                                  share|improve this answer

























                                                                                                                                                                                                                                                    up vote
                                                                                                                                                                                                                                                    0
                                                                                                                                                                                                                                                    down vote













                                                                                                                                                                                                                                                    To Access project outside localhost



                                                                                                                                                                                                                                                    Example:



                                                                                                                                                                                                                                                    ng serve --host 192.168.2.2:7006





                                                                                                                                                                                                                                                    share|improve this answer























                                                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                                                      0
                                                                                                                                                                                                                                                      down vote










                                                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                                                      0
                                                                                                                                                                                                                                                      down vote









                                                                                                                                                                                                                                                      To Access project outside localhost



                                                                                                                                                                                                                                                      Example:



                                                                                                                                                                                                                                                      ng serve --host 192.168.2.2:7006





                                                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                                                      To Access project outside localhost



                                                                                                                                                                                                                                                      Example:



                                                                                                                                                                                                                                                      ng serve --host 192.168.2.2:7006






                                                                                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                                                                                      answered Aug 28 at 11:37









                                                                                                                                                                                                                                                      Dibish

                                                                                                                                                                                                                                                      2,560114078




                                                                                                                                                                                                                                                      2,560114078






















                                                                                                                                                                                                                                                          1 2
                                                                                                                                                                                                                                                          next

















                                                                                                                                                                                                                                                           

                                                                                                                                                                                                                                                          draft saved


                                                                                                                                                                                                                                                          draft discarded



















































                                                                                                                                                                                                                                                           


                                                                                                                                                                                                                                                          draft saved


                                                                                                                                                                                                                                                          draft discarded














                                                                                                                                                                                                                                                          StackExchange.ready(
                                                                                                                                                                                                                                                          function () {
                                                                                                                                                                                                                                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f39091735%2fport-4200-is-already-in-use-when-running-the-ng-serve-command%23new-answer', 'question_page');
                                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                                          );

                                                                                                                                                                                                                                                          Post as a guest















                                                                                                                                                                                                                                                          Required, but never shown





















































                                                                                                                                                                                                                                                          Required, but never shown














                                                                                                                                                                                                                                                          Required, but never shown












                                                                                                                                                                                                                                                          Required, but never shown







                                                                                                                                                                                                                                                          Required, but never shown

































                                                                                                                                                                                                                                                          Required, but never shown














                                                                                                                                                                                                                                                          Required, but never shown












                                                                                                                                                                                                                                                          Required, but never shown







                                                                                                                                                                                                                                                          Required, but never shown











                                                                                                                                                                                                                                                          Popular posts from this blog

                                                                                                                                                                                                                                                          Xamarin.iOS Cant Deploy on Iphone

                                                                                                                                                                                                                                                          Glorious Revolution

                                                                                                                                                                                                                                                          Dulmage-Mendelsohn matrix decomposition in Python