Skip to content

Eclipse preferences: The '/usr/local/lib/node_modules/@angular/cli/bin/ng' is not a ng file. #64

Open

Description

@javaspeak

Hi Angelo and other Devs,

I am using a Mac and have installed "http://oss.opensagres.fr/angular2-eclipse/1.2.0-SNAPSHOT/" into NEON.

When I go to:

 Eclipse ==> Preferences ==> JavaScript ==> Typescript ==> Angualr2 ==> CLI 

it says at the top of the window:

The '/usr/local/lib/node_modules/@angular/cli/bin/ng' is not a ng file.

However there is a shell script ng file in the location:

  $ ls -ltr /usr/local/lib/node_modules/@angular/cli/bin/
 total 16
 -rwxr-xr-x  1 nobody  staff  5982 Mar 14 02:35 ng

I am not sure if this a permission problem or that the eclipse plugin is expecting a different format ng file. Like I said this ng file in the above location is a shell script. The eclipse plugin found the location by itself - I did not choose it.

I did previously run this command before installing the angular2-eclipse plugin:

 sudo npm install -g @angular/cli

Because of this configuration problem if I do:

  File ==> New Angular 2 Project

and try to create a new project it shows in the Terminal window:

~/Documents/workspace$ ng new bling
bash: ng: command not found

Incidentally because of this failure, no project is created at all on the file system when trying to create a Angular 2 project.

Finally if I type on the command line :

which ng

I get:

 $ which ng
/usr/local/bin/ng

Maybe the eclipse plugin could try that location instead. For some reason If in the above preference section of eclipse and I select the radio button "Use ng custom file" and try and navigate to "/usr/local/bin/ng" I cannot access the path. Maybe this a Mac feature of eclipse.

Not sure if I have given enough information for you to know what the problem is.

Thank you for your time and your contribution to this plugin

Activity

  1. angelozerr commented on Mar 24, 2017

    @angelozerr
    Owner

    The '/usr/local/lib/node_modules/@angular/cli/bin/ng' is a JavaScript file which must be executed with node When you install @angular/cli globally, it install the /usr/local/bin/ng which basicly does 'node /usr/local/lib/node_modules/@angular/cli/bin/ng'.

    So the well file is "/usr/local/bin/ng" as you have said ($ which ng).

    For some reason If in the above preference section of eclipse and I select the radio button "Use ng custom file" and try and navigate to "/usr/local/bin/ng" I cannot access the path. Maybe this a Mac feature of eclipse.

    The "Use ng custom file" waits for a directory (and not the file) which contains the ng/ng.cmd file. So you should select "/usr/local/bin/" and not "/usr/local/bin/ng".

    When Terminal is opened, it adds in the env path this directory before opening the terminal. If you have not admin privilege, you can use directly the ng file. See #56 (comment)

  2. tiramon commented on Mar 30, 2017

    @tiramon

    i just tried to set this up on a mac too

    i tried "/usr/local/bin/" as you said, i also tried to install cli local in my workspace and i always get the same error.

    I guess it's the @ in the path, because "/usr/local/bin/ng" is only a symbolic link to '/usr/local/lib/node_modules/@angular/cli/bin/ng'
    and if i want to cd to the cli bin folder i have to escape the @ like this

    cd /usr/local/lib/node_modules/\@angular/cli/bin/

    i guess you also have to escape the @ in your call, if this does not fix it i'm out of ideas how to get it working

    if i execute a
    export PATH=$PATH:/usr/local/lib/node_modules/\@angular/cli/bin
    in the terminal it works for me

  3. tiramon commented on Mar 30, 2017

    @tiramon

    but i still get problems when i try to run ng serve etc, even when i do a export in that terminal window

    it tells me
    node_modules appears empty, you may need to run npm install

  4. angelozerr commented on Mar 30, 2017

    @angelozerr
    Owner

    export PATH=$PATH:/usr/local/lib/node_modules/@angular/cli/bin

    Thanks for this information.

    but i still get problems when i try to run ng serve etc, even when i do a export in that terminal window

    Once your ng project is created, you should have a .bin folder inside your project which contains the ng. Try to modify this properties with ng custom file.

  5. angelozerr commented on Apr 9, 2017

    @angelozerr
    Owner

    @tiramon please reinstall 1.2.0 and tell me if your problem dispapear, thanks

  6. angelozerr commented on Apr 12, 2017

    @angelozerr
    Owner

    @tiramon could you tell me if it works now please?

  7. angelozerr commented on Apr 17, 2017

    @angelozerr
    Owner

    None answer, I close this issue. @tiramon please install 1.2.0 release, if you have problem again, please reopen it.

  8. tokiaquino commented on Nov 3, 2017

    @tokiaquino

    @angelozerr
    I have the same problems when configure Eclipse global preferences

    imagen

  9. tokiaquino commented on Nov 3, 2017

    @tokiaquino

    And when create an Agular Project, stay " Searching for global Angular CLI..."
    imagen

  10. tokiaquino commented on Nov 3, 2017

    @tokiaquino

    And when create an Agular Project, stay " Searching for global Angular CLI..."

    imagen

  11. angelozerr commented on Nov 3, 2017

    @angelozerr
    Owner

    @Springrbua could you help us with this issue please?

  12. probert94 commented on Nov 4, 2017

    @probert94
    Contributor

    @tokiaquino are you using latest (1.4 Snapshot) version?
    I just had a look at my installation and there it says "use global preferences" instead of "use global" as in your case.
    In the latest version it is possible, to use the CLI-Installation you configure in the global preferences, instead of just the global CLI-Installation.

  13. tokiaquino commented on Nov 4, 2017

    @tokiaquino

    @Springrbua i confirm on monday because is in my work computer, but i have the same problem when configure global preference like i mention on previous comment

  14. probert94 commented on Nov 4, 2017

    @probert94
    Contributor

    @tokiaquino yea there were a few issues with the cli-settings in the 1.3 version. The ones I know about should be fixed with latest snapshot.
    You might need to change the update side to get the update to the latest version.

  15. 13 remaining items

  16. angelozerr commented on Nov 30, 2017

    @angelozerr
    Owner

    You guys need to create and run tests..

    @josersleal please note that we develop this plugin in our free time. More we have Windows OS, it's difficult for me and @Springrbua to test with another OS. So if you have problem, please help us, thanks.

    For run tests, please give us suggestion, I don't know how to write tests for this issue, please help us.

  17. probert94 commented on Nov 30, 2017

    @probert94
    Contributor

    @josersleal @angelozerr I am waiting for my new notebook, which I should get the next weak.
    I'll then take a look at it, I know, the CLI-Settings is causing some trouble...
    @josersleal as @angelozerr said, we are working on this in our free time. Also it is an open source project, so you are free to contribute to it.
    Any help is very welcome :)

  18. jfrantzius commented on Dec 1, 2017

    @jfrantzius

    With 1.3.x on Mac I also saw the original error reported in this issue (though with a different install location of ng, but I guess that doesn't matter). After upgrading to current 1.4.x, the error went away.

    However, I had to manually de-install the 1.3.x feature, because the feature name seems to have changed between versions. Before de-installing the old feature, I was seeing two "Angular" preference sections, out of which one was still showing the reported error.

    So as I'd see it, the original error is fixed in 1.4.x on Mac ...

  19. angelozerr commented on Dec 1, 2017

    @angelozerr
    Owner

    So as I'd see it, the original error is fixed in 1.4.x on Mac ...

    @jfrantzius thanks for your feedback!

    With 1.4.0 (SNAPSHOT), nodejs 8.9.1 and angular 1.5.4 (installed globally) it worked - though it keeps offering me nodejs 6.x-something (embedded) by default - which is a bit annoying as I am not intending to use that.

    @divStar Please reinstall 1.4.0 (SNAPSHOT), nodejs 8.9.1 should be available as embed nodejs (see angelozerr/typescript.java#222), hope it will work for you.

  20. stephaneeybert commented on Mar 15, 2018

    @stephaneeybert

    On Eclipse Neon 3 (4.6.3) and Angular Eclipse 1.3.0 I also get the same message:

    The '/home/stephane/.nvm/versions/node/v9.7.1/lib/node_modules/@angular/cli/bin/ng' is not a ng file.

    $ which ng
    /home/stephane/.nvm/versions/node/v9.7.1/bin/ng
    [stephane@stephane-ThinkPad-X201 ~]
    $ file /home/stephane/.nvm/versions/node/v9.7.1/bin/ng
    /home/stephane/.nvm/versions/node/v9.7.1/bin/ng: symbolic link to ../lib/node_modules/@angular/cli/bin/ng
    [stephane@stephane-ThinkPad-X201 ~]
    $ file /home/stephane/.nvm/versions/node/v9.7.1/lib/node_modules/@angular/cli/bin/ng
    /home/stephane/.nvm/versions/node/v9.7.1/lib/node_modules/@angular/cli/bin/ng: a /usr/bin/env node script, ASCII text executable
    [stephane@stephane-ThinkPad-X201 ~]
    $ ng -v
    
        _                      _                 ____ _     ___
       / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
      / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
     / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
    /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                   |___/
        
    Angular CLI: 1.7.2
    Node: 9.7.1
    OS: linux x64
    Angular: 
    ...
    $ /home/stephane/.nvm/versions/node/v9.7.1/bin/ng -v
    
        _                      _                 ____ _     ___
       / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
      / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
     / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
    /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                   |___/
        
    Angular CLI: 1.7.2
    Node: 9.7.1
    OS: linux x64
    Angular: 
    ...
    
    

    On Lubuntu 16.04

  21. angelozerr commented on Mar 15, 2018

    @angelozerr
    Owner
  22. stephaneeybert commented on Mar 16, 2018

    @stephaneeybert

    @angelozerr Thanks for the suggestion. I see a number of files in that directory. I don't know what to do with these files. You have a few guiding instructions ? Cheers.

  23. probert94 commented on Mar 16, 2018

    @probert94
    Contributor

    @stephaneeybert you only need to use http://oss.opensagres.fr/angular-eclipse/snapshot/ as update site for the plugin.
    I would uninstall the older version (1.3.0) first and then use this URL to install the plugin.

  24. stephaneeybert commented on Mar 16, 2018

    @stephaneeybert

    @angelozerr After removing the plugin, I tried to add software from the given url but my Eclipse could not perform the operation and hanged trying to find alternate solutions.

  25. sayantansinha commented on Aug 17, 2018

    @sayantansinha

    @angelozerr @Springrbua have you guys added support for Angular-CLI 6?

  26. armita-burjwal commented on Sep 25, 2018

    @armita-burjwal

    Any update on this??

  27. armita-burjwal commented on Sep 26, 2018

    @armita-burjwal

    After adding 1.4.0 when i create a new project it is showing " No Angular CLI installation found in global preferences."

  28. Tony-Esales commented on Jun 26, 2019

    @Tony-Esales

    I'm getting the same error pointed by @javaspeak. The ng file exists and it's working fine, but some validation is telling the file is not a ng file (that is not true). I have installed globally Angular CLI version 8.0.4.
    Eclipse version: 2019-06
    Plugin version: latest (just installed it by Eclipse Marketplace

    @angelozerr Can you help me?

  29. probert94 commented on Jun 26, 2019

    @probert94
    Contributor

    @Tony-Esales the Plugin hasn't been updated since a while and the Angular CLI changed quite a bit in that time. My guess is, that the command used to check the validity of the ng-file has been changed or even removed.

  30. angelozerr commented on Jun 26, 2019

    @angelozerr
    Owner

    @angelozerr Can you help me?

    I'm sorry guys but I have no time to continue this project. The new Angular support inside Eclipse is inside the new project https://github.com/eclipse/wildwebdeveloper but ng is not included for the moment eclipse-wildwebdeveloper/wildwebdeveloper#147

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