Skip to content

ng build command not working #56

Closed

Description

@sayantansinha

I just installed it on a new Eclipse installation and the same ng command that was working on my earlier installation seems to be NOT working any more. Was the 1.2.0-SNAPSHOT recently updated / modified? I noticed a couple of changes:

  • Previously, the output was redirected to Eclipse Console and now it is launched in a Terminal
  • Previously, the command node <path_to_ng_from_preferences> build/serve was executed but now it just launches the ng build which fails as I do not have ng added to my system Path variable and neither can I add it due to corporate policies

Any help would be greatly appreciated!!

Activity

  1. angelozerr commented on Mar 8, 2017

    @angelozerr
    Owner

    Previously, the output was redirected to Eclipse Console and now it is launched in a Terminal

    Indeed, I'm doing a big refactoring to use terminal instead of console to benefit with syntax coloration of the cli, replay the command (or an another) inside terminal, answer to some cli question ("override it?" like)

    Which OS do you use?

    Previously, the command node <path_to_ng_from_preferences> build/serve was executed but now it just launches the ng build which fails as I do not have ng added to my system Path variable and neither can I add it due to corporate policies

    Now <path_to_ng_from_preferences> should be the directory which contains the "ng" / "ng.cmd". Please check the CLI Preferences (I have improved too this preferences to see the CLI Version, CLI Path).

    At the end, I suggest you to use @angular/cli and not angular-cli which is now old.

  2. sayantansinha commented on Mar 8, 2017

    @sayantansinha
    Author

    Which OS do you use?

    Windows 7

    Now <path_to_ng_from_preferences> should be the directory which contains the "ng" / "ng.cmd". Please check the CLI Preferences (I have improved too this preferences to see the CLI Version, CLI Path).

    Yes I do see that, but I also see a problem here, if I add the physical path by browsing file system it is able to recognize and show the CLI Version and path as you have said, but if I use eclipse environment variable (like "${project_loc:node_modules/.bin}") or use workspace path by "Browse Workpsace" and pointing to the exact same path, it throws the error that it is not able to find it. The path in question here is the.bin folder in my project's node_modules.

    The problem here is that, even if it recognizes the path and shows the CLI version and path in preferences, but when it executes the command it never uses that path, instead it seems to expect a global ng installation and therefore executes the "ng serve" command instead of the earlier command "node <path_to_ng_from_preferences>/ng serve" which has been working fine for me

    At the end, I suggest you to use @angular/cli and not angular-cli which is now old.

    Yes, I am using @angular/cli

  3. sayantansinha commented on Mar 9, 2017

    @sayantansinha
    Author

    Any help on this would be really great

  4. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    Before opening the terminal to execute a "ng" command, the "PATH" env is updated by adding at first your node path and ng path.

    After that the terminal is opened by executing the "ng build" by the Eclipse launch, could you type:

    echo %PATH%

    And check that your $project/node_modules/.bin directory is in the path.

  5. sayantansinha commented on Mar 10, 2017

    @sayantansinha
    Author

    Now, I think I know where the issue is, actually since I am doing this on my work laptop which does not give me admin privileges and therefore the PATH variable is not set. Is it possible to use the whole custom path for running the command instead of setting it to the PATH variable?

  6. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    At first I have decided to use PATH env variable because :

    • ng needs node. So even if you can call ng file, if your node is not in your path, it will not work.
    • it avoids to select ng.cmd for windows and ng for other OS, so your preferences of ng is the same for any OS.

    If you type:

    echo %PATH%

    What is your Path? Is it empty? If it that it's strange because I create this variable even if it doesn't exists.

    If it is empty, please reinstall 1.2.0-SNAPSHOT and tell me if your PATH is empty or not. Thanks

  7. sayantansinha commented on Mar 10, 2017

    @sayantansinha
    Author

    Since, I had node installed using the installer it does exist already in my path, adding ng would take a lot of bureaucracy which I want to avoid. So, if you can just allow ng to run withe the full path it would suffice.
    My PATH is definitely not empty as I have other entries along with the node one

  8. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    But have you in your PATH env the path of ng directory that you have customized with preferences?

  9. sayantansinha commented on Mar 10, 2017

    @sayantansinha
    Author

    No it is not there, as when I run Eclipse with this plugin as you said it tries to add to my Path variable before the terminal launches which the system would not allow as I do not have admin access. Node was installed by a admin user which added the node path to PATH so the node path is already there

  10. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    No it is not there, as when I run Eclipse with this plugin

    I update the PATH before opening the terminal. Please reinstall 1.2.0-SNAPSH

  11. sayantansinha commented on Mar 10, 2017

    @sayantansinha
    Author

    Ok already shut my laptop, will try it out tomorrow and update. Just curious, did you change this after I reported the issue?

  12. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    Indeed that very strange. If you can debug it, it should be very cool.

  13. angelozerr commented on Mar 10, 2017

    @angelozerr
    Owner

    @sayantansinha I have added a checkbox "Execute ng with file?" to execute ng with the ng.cmd file. So you must select the directory of ng (like today) and select this checkbox.

    We have a problem with build since textmate.java was migrated to Eclipse.org. Once this problem will be fixed you will able to reinstall 1.2.0-SNAPSHOT to test this new preference.

  14. sayantansinha commented on Mar 11, 2017

    @sayantansinha
    Author

    Ok got it, will wait for your update then to reinstall. Btw, is there any logs where I can check what is going on in the background, might help you with narrowing down the issue. It sounds to me like an issue with work laptops where admin rights are restricted.

  15. angelozerr commented on Mar 12, 2017

    @angelozerr
    Owner

    It sounds to me like an issue with work laptops where admin rights are restricted.

    Yes perhaps the update of Path that it is done before the open of terminal is not applied in this context? I cannot test that. If you can execute typescript.java with sources and debug it, it should be very cool.

  16. sayantansinha commented on Mar 13, 2017

    @sayantansinha
    Author

    With the new preference it works now as it is using the full path. Thanks.
    However, once it is enabled you cannot remove it from preferences.

    One additional thing that you might look into, if I run one of the commands with a set preference then the "Eclipse->Run Configuration" option stores that preference permanently, and it does not change if I change the Eclipse preferences for Angular CLI, so it continues to run with the previous preference configuration. Should it behave like that? Or should it always pick up the latest preference? Just a thought tha tyou might want to consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions