facebook

Launch Angular on a different port

  1. CodeMix & Angular IDE
  2.  > 
  3. Getting Help

Tagged: 

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #603611 Reply

    rolandh
    Participant

    I want to launch one project on the default port 4200 and one on port 4400. Unfortunately the new CodeMix 2 creates automatically a new launched instance (seems like on port 4200). This gets in conflict if I want to start two instances.
    This is as well a problem if I want to stop Angular. Cause I do not really know one would stop both instances at once.

    #603652 Reply

    Hi rolandh,

    Just to confirm and in order to help you better:
    You didn’t have this issue previous the release of CodeMix 2?
    Have you configured angular config file (usually angular.json) to run on a different port ?

    Best regards,
    Sal

    #603730 Reply

    rolandh
    Participant

    Sorry, I’m getting highly confused about your reply :-/

    First of all, the version it says on the preference page: CI 2018.11.26

    • Where could I find some documentation about angular.json? I searched but did NOT find any valuable hint about the settings.
    • Do you say I need to configure the port in this file? If so, how?
    • I configured the settings in the Servers view, under Angular CLI, right click and select Properties... wich opens a dialog: Edit Configuration. There I have a parameter called Port and this is set. Do you say I should notuse this option? If so, what good is this option?
    • Since another Server is initiated (with a different port than 4200) how to stop properly? Plus launch another istance?
    • Under the folder .vscode I find launch.json with another configuration – most likely as well for WebClipse. What is this good for?
    • Last but not least: Where to find documentation about the different option settings? In general… Cuz in the settings I have as well Workspace Settings but beside marketing announcements I don’t find on your website not much about technical settings. So, where to find more details about them?

    Major point: How to configure a different port? To have an answer to the rest would be great as well. Not only for myself but I guess for others as well 😉

    #603732 Reply

    rolandh,

    I’m sorry to know you are having confusion. Let me try to answer some of your queries.

    1. Yes, 2018.11.26 displayed in preference page and this is the latest CodeMix version released.

    2. You can configure a port in angular.json for a project following below structure in angular.json –
    “projects”: {
    “my-angular-project”: {

    “architect”: {
    “serve”: {
    “options”: {
    “port”: 4400
    }
    }
    }
    }
    }
    Screenshot: https://gyazo.com/fc2477e1a30a450282c72632eea66e5d

    3. Yes, you can configure port settings in the Servers view using Edit Configuration > Port parameter. You may want to restart the server after editing the port number.
    Screenshot: https://gyazo.com/2ba4fbe99f3adc9a966ad9dfde8552a4

    4. In order to stop another via CodeMix instance running on a port,
    Server View > select the application > Click Stop the server icon in the tool bar
    Or
    Server View > select the applciation > Right click > Click “Stop Server” option from context menu.
    In case you would like to explicitly kill the process outside CodeMix which is using the port, following commands might help –
    (Windows command line )
    – To find out which process is using port 4200. (For example process id = 1234 is using port 4200)
    netstat -aon | find /i “listening” | find “4200”
    – To kill the process using the port
    taskkill /pid 1234 /f

    5. launch.json under .vscode helps with debugging your application. You can configure various debugging settings in launch.json and launch CodeMix Debug session.

    6. You can hover a specific workspace setting property to see details as shown in screenshot below –
    https://gyazo.com/139292776c7ebc11e84d814847ad8429

    Let us know if above answers your queries.

    #603738 Reply

    rolandh
    Participant

    Hi,

    I tried to follow your description and I’m not really successful :-/ The configuration as you pointed out does not help. I congfiured port “4412” but the application is still reachable under 4400. I don’t know if this makes anyhow sense – but to my understanding its a valid configuration.

    I configured my app like https://ibb.co/zF5z810 pointing to port 4400. As seen in the screeshot of https://ibb.co/5cfhrwZ I have two running instances. I do not understand why the instance on port 4200 is launched. I do NOT need it.

    Thx for the details and explenation. The hover functionallity was a hidden feature 😉

    Since working with different ports was already available in V1 of WebClipse I am now surprised to have a different behaviour.

    #603753 Reply

    rolandh,

    As I understand your objective, you wish to run the same project with two different Launch Configs such that each launch config is using different port.

    I am able to create two different launch configs of same angular project using different ports. I see that app is accessible one at a time on different ports.

    Can you help us with more details to investigate the issue better –
    1. Operating system that you are working with.
    2. Eclipse version and package.
    3. Are you able to start the server using each launch config one at a time ?
    4. If you stop the server (launch config with port 4200) > restart eclipse > start the server with launch config with port 4400, is the port respected when you access the application ?

    #603756 Reply

    rolandh
    Participant

    Hello,

    no, I have multiple Angular projects in the same workspace. At least one we want to migrate to a different UI (Angular material). Therefore looking forth and back would be great.

    1. Linux, OpenSuSe, TumbleWeed
    2. Eclipse: Version: 2018-09 (4.9.0), Build id: 20180917-1800
    3. Yes
    4. No, as see on the screenshot: I launch it on 4400 ==> one config is launched with 4400 and one with 4200. And I can terminate 4400 but 4200 still active.
    #603773 Reply

    Hi rolandh,

    Thanks for your help, we have been finally managed to reproduce the issue.
    The problem seems to be linked to recent versions of Angular, so just to confirm, what version of Angular and Angular CLI are you using?

    Cheers,
    Sal

    #603838 Reply

    rolandh
    Participant

    “@angular/cli”: “^7.0.4”,
    “@angular/compiler-cli”: “^7.0.2”,

    #603868 Reply

    Hi rolandh,

    Thank you for the info. The problem seems to appearing on @angular/cli >= 7.0.0 versions.
    We will work on it and let you know when we have a fix a available.

    Cheers,
    Sal

    #604210 Reply

    Hi rolandh,

    Just reaching out to let you know that we have pushed a new version of the angular-ide npm package which fixes the problem with running Angular applications on a different port.

    In order to get this fix, just create a new Terminal+ tab for the related Angular project and run:
    npm r -D angular-ide && npm i -D angular-ide

    This will install the latest angular-ide.

    Cheers,
    Sal

    #604271 Reply

    vijaydeveloper
    Participant

    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

    For learning: https://hackr.io/tutorials/learn-angular

    #604273 Reply

    rolandh
    Participant

    Hi Sal,

    sorry to be rude – but did you test that package by yourself?

    The whole thing gets even worse 🙁 Now the app does not even start, complains that port 4200 is blocked and does ignore all other parameters (especially base-href). So, your proposed solution is a solution which wrecks my whole installation.

    I installed the previous version via npm install angular-ide@0.9.53 and now I’m at least able to launch the app 🙁

    roland

    #604411 Reply

    support-swapna
    Moderator

    Roland,

    Sorry that the fix did not work for you. We do test all our fixes thoroughly before releasing them.
    The dev team is looking into your report and they will get back to you soon.

    Apologies once again for inconvenience caused.

    –Swapna
    Genuitec Support

    #604515 Reply

    Hi Roland,

    Sorry for the inconvenience, we have identified the root of the issue and released a new version of angular-ide npm package which should address the problem.

    As usual, you can run the following command to install the latest version:

    npm r -D angular-ide && npm i -D angular-ide

    Cheers,
    Sal

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: Launch Angular on a different port

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in