You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng command not recognized in eclipse preference #107
After I add my angular-cli path on the Javascript->Typescript->Angular-CLI option under Eclipse Preference I get an error saying "The '/node_modules//bin/ng' is not a ng file". I am currently using macOS Sierra (v10.12.6) and using the same ng --version command provides the correct output listing down the version. I got this ng file after running npm install on my project's package.json which is referring to v1.0.2
Any help would be really appreciated.
After I add my angular-cli path on the Javascript->Typescript->Angular-CLI option under Eclipse Preference
I'm not sure, but I think this preference is not used with Angular Eclipse 1.3.0 since you can install ng cli in your wizard when you create a cli project. Hav you tried to create an new project with the wizard?
@Springrbua could you see if Javascript->Typescript->Angular-CLI option is used? If not perhaps we should update the wizard?
Let me give more background, I created this project using v1.2.0 and on a windows 7 os. Now, I am hust trying to use the same projecton a mac and I setup the ltes v1.3.0 of the plugin. I was not aware that this preference was not used anymore. So why is it there in the first place? If it is not used then how does the terminal recognizes the ng command? To further note, this is a company issued mac so I do not have admin privileges (going back to my previous issue where I highlighted the same problem for which the execute ng with file option was added by you), as a result of which I am not able to install ng globally as well. So, I am not trying to create a new project, I am trying to access an existing project and just trying to run it after setting it up.
@angelozerr The preferences are still in use. Actually the new wizard also just updates this preferences with the options you set.
@sayantansinha The field where you enter the ng location should already provide a default option, if you click on the little arrow on the left. This default option uses the $Project variable and links to the project specific ng installation.
This value used to work for me, so you could try that.
EDIT:
The global preferences are not used if you create a new project, as it always creates project specifc settings. If instead you import a project it will probably use the global settings.
@Springrbua yes I tried that as well and it does not work on either of the platforms (windows or mac) for me. The preferences page shows an error on the top and does not allow me to got another preference popping a message saying this page has invalid options set.
Finally it worked, I followed @Springrbua suggestion:
EDIT:
The global preferences are not used if you create a new project, as it always creates project specifc settings. If instead you import a project it will probably use the global settings.
I just turned on the project specific settings wherein the default worked
${project_loc:node_modules/.bin}
Also, had to make sure to delete any existing run configurations for the same project as changing the preferences and then running with the same run configuration did not pick up the latest preference (@Springrbua - shouldn't this be something that need to be fixed?)
Hope this might be helpful for someone in the future.
Thanks for the feedback!
Probably the global preferences shouldn't validate ng installation, since it is possible to use project variables, which only exist in projects. @angelozerr what do you think about that?
I have to take a look at the problem with the run configurations, I never had this bug but I'll try to reproduce it.
Thanks for your patience and your detailed feedback :)
Probably the global preferences shouldn't validate ng installation, since it is possible to use project variables
If I remember I had done that, to configure ng path for the whole project of the workspace (it's a kind of ng global installation). But if it's confusing, perhaps we should remove this preferences since now ng new project wizard gives the capability to use ng global installed angular-cli or a given angular-cli to install?
@angelozerr I'll take a look at it as soon as possible
I guess we should keep the global preferences, because one could use a "global" cli-installation which is installed in some custom folder. This is currently not possible with the Wizard, since it lets you only choose global installation (installed with npm install -g) or install project specific cli.
But I'll take a look at it to see whats better.
I guess we should keep the global preferences, because one could use a "global" cli-installation which is installed in some custom folder.
Exactly, it was my idea.
This is currently not possible with the Wizard, since it lets you only choose global installation (installed with npm install -g) or install project specific cli.
Yes it's the problem. We should add it in the wizard or remove it from General / Preferences.
Adding my 2 cents, I never use the global settings as my project specific angular-cli installation is what I prefer to use as that is what is going to be used for my eventual building of the final artifacts.
Additionally, I think you guys also need to look into the fact that why the existing run configurations doesn't get updated with the latest changes I do to the preferences wizard. It always refers to the old one and you have to delete and reconfigure the run settings again to allow it to pick up the latest preferences.
@sayantansinha Yea of course, I'll also take a look at that. I'll try to reproduce the issue and I'll probably open a new Issue for it.
Thanks again for your feedback!
@Springrbua I've tried that several times with different versions of CLI. Didn't work. It creates a project with just the node_modules folder in it. No src and e2e folders, no angular.json, package.json, tsconfig.json...
My point is not to blame you for your limited time. I think, many people could safe a lot of nerves and time if it was taken down from the marketplace as long as this is neither fixed nor a reasonable workaround is provided.
What is the snapshot update site and where can I find it?
My Eclipse is currently broken by this error, because I can't close the Angular CLI preferences page anymore ("The currently displayed page contains invalid values").
The problem persists. I have checked the output of ng --version. That's kind of strange with ASCII art. I don't know, whether there is a variant of the --version option without ascii art. You won't be able to fix this as long as they keep playing around with crap like that in their version output.
You might want to consider a boolean option (checkbox) in the preferences / the new project dialog to skip CLI validation. Or something like: "use ng.cmd anyway, I know, what I'm doing." This might help most people with a standard installation of angular cli.
Thanks for your feedback @trhsrw . I agree with you, this version search must perhaps be less restrictive. I must find time to study this problem and do something.
I found a solution to "The 'ng' is not a ng file." problem. You have to have ng set in your $PATH before starting Eclipse IDE. After that you should be able to create new Angular projects with angelo's plugin, since the plugin should find ng from $PATH (global _preferences).
For example: on your ~/.profile (or where ever your $PATH is set) file
PATH="$PATH:/usr/lib/node_modules/@angular/cli/bin"
Change Angular path to match your installation.
So this 'bug' seems to be more related to configuration.. Maybe this 'Global preference' should be editable so plugin would use users configuration instead of $PATH (if it is not found from $PATH)
On Windows $PATH would mean your Environment variables...
I hope this helps.. it solved my case of "The 'ng' is not a ng file."
@JJN2 If you select global cli, you should have angular-cli installed globally, by using npm install @angular/cli -g. This should install it in the global node_modules, which should be part of the path by default.
Basically, the plugin just executes ng --version, to check if a valid angular-cli version is available. If the ng-command is not part of the path, then it won't be able to execute it.
Usually, it is a good idea to install angukar-cli globally, if you are developing applications with it, because otherwise you won't be able to execute all the ng-commands easily.
Angular was installed globally with -g flag (as instructed in Angular web pages). It was globally usable since ng commands could be run from any folder location but $PATH settings were never modified by npm install -g ...
Problem was that angular path was not defined in $PATH which is set by default in ~/.profile on Debian Jessie distro of Linux. Eclipse plugin for some reason needs Angular path defined in $PATH or it won't find ng at all when using Global preferences.
Problem is that the embedded nodejs is used inside the $PATH.
You probably need to setup an external path for nodejs-first because the newest "@angular/cli" is not compatible with the embedded nodejs that gets used.
The plugin uses embedded 6.9.4 by default wich won't work with the ng-command.
@garymazz: I ended up using the Eclipse WildWebDeveloper plugin (strongly recommended anyway) and the Angular CLI in Eclipse‘s terminal view. Works best for my purposes.
Activity
angelozerr commentedon Aug 12, 2017
I'm not sure, but I think this preference is not used with Angular Eclipse 1.3.0 since you can install ng cli in your wizard when you create a cli project. Hav you tried to create an new project with the wizard?
@Springrbua could you see if Javascript->Typescript->Angular-CLI option is used? If not perhaps we should update the wizard?
sayantansinha commentedon Aug 12, 2017
Let me give more background, I created this project using v1.2.0 and on a windows 7 os. Now, I am hust trying to use the same projecton a mac and I setup the ltes v1.3.0 of the plugin. I was not aware that this preference was not used anymore. So why is it there in the first place? If it is not used then how does the terminal recognizes the ng command? To further note, this is a company issued mac so I do not have admin privileges (going back to my previous issue where I highlighted the same problem for which the execute ng with file option was added by you), as a result of which I am not able to install ng globally as well. So, I am not trying to create a new project, I am trying to access an existing project and just trying to run it after setting it up.
probert94 commentedon Aug 12, 2017
@angelozerr The preferences are still in use. Actually the new wizard also just updates this preferences with the options you set.
@sayantansinha The field where you enter the ng location should already provide a default option, if you click on the little arrow on the left. This default option uses the $Project variable and links to the project specific ng installation.
This value used to work for me, so you could try that.
EDIT:
The global preferences are not used if you create a new project, as it always creates project specifc settings. If instead you import a project it will probably use the global settings.
sayantansinha commentedon Aug 12, 2017
@Springrbua yes I tried that as well and it does not work on either of the platforms (windows or mac) for me. The preferences page shows an error on the top and does not allow me to got another preference popping a message saying this page has invalid options set.
sayantansinha commentedon Aug 12, 2017
Finally it worked, I followed @Springrbua suggestion:
I just turned on the project specific settings wherein the default worked
Also, had to make sure to delete any existing run configurations for the same project as changing the preferences and then running with the same run configuration did not pick up the latest preference (@Springrbua - shouldn't this be something that need to be fixed?)
Hope this might be helpful for someone in the future.
probert94 commentedon Aug 13, 2017
Thanks for the feedback!
Probably the global preferences shouldn't validate ng installation, since it is possible to use project variables, which only exist in projects. @angelozerr what do you think about that?
I have to take a look at the problem with the run configurations, I never had this bug but I'll try to reproduce it.
Thanks for your patience and your detailed feedback :)
angelozerr commentedon Aug 13, 2017
@Springrbua I'm very busy for the moment with Codelens, if you have time please try it and give me feedback, thanks!
probert94 commentedon Aug 14, 2017
@angelozerr I'll take a look at it as soon as possible
angelozerr commentedon Aug 14, 2017
If I remember I had done that, to configure ng path for the whole project of the workspace (it's a kind of ng global installation). But if it's confusing, perhaps we should remove this preferences since now ng new project wizard gives the capability to use ng global installed angular-cli or a given angular-cli to install?
Thanks!
probert94 commentedon Aug 14, 2017
So you would remove the global settings? Or should I just add a "use global settings" option to the wizard and validate it only there?
angelozerr commentedon Aug 14, 2017
Yes it was my idea, but if it's more complex to understand, perhaps we should remove this preferences, I don't know.
probert94 commentedon Aug 14, 2017
I guess we should keep the global preferences, because one could use a "global" cli-installation which is installed in some custom folder. This is currently not possible with the Wizard, since it lets you only choose global installation (installed with
npm install -g) or install project specific cli.But I'll take a look at it to see whats better.
angelozerr commentedon Aug 14, 2017
Exactly, it was my idea.
Yes it's the problem. We should add it in the wizard or remove it from General / Preferences.
Thanks!
sayantansinha commentedon Aug 14, 2017
Adding my 2 cents, I never use the global settings as my project specific angular-cli installation is what I prefer to use as that is what is going to be used for my eventual building of the final artifacts.
Additionally, I think you guys also need to look into the fact that why the existing run configurations doesn't get updated with the latest changes I do to the preferences wizard. It always refers to the old one and you have to delete and reconfigure the run settings again to allow it to pick up the latest preferences.
probert94 commentedon Aug 15, 2017
@sayantansinha Yea of course, I'll also take a look at that. I'll try to reproduce the issue and I'll probably open a new Issue for it.
Thanks again for your feedback!
13 remaining items
trhsrw commentedon Jun 14, 2018
@Springrbua I've tried that several times with different versions of CLI. Didn't work. It creates a project with just the node_modules folder in it. No src and e2e folders, no angular.json, package.json, tsconfig.json...
My point is not to blame you for your limited time. I think, many people could safe a lot of nerves and time if it was taken down from the marketplace as long as this is neither fixed nor a reasonable workaround is provided.
angelozerr commentedon Jun 14, 2018
is it working with snapshot update site? If yes, I think we should to create a new release.
trhsrw commentedon Jun 14, 2018
What is the snapshot update site and where can I find it?
My Eclipse is currently broken by this error, because I can't close the Angular CLI preferences page anymore ("The currently displayed page contains invalid values").
angelozerr commentedon Jun 14, 2018
https://github.com/angelozerr/angular-eclipse/wiki/Installation-Update-Site
trhsrw commentedon Jun 14, 2018
Thanks a lot. I had tried .../1.4.0/ and .../1.4.0-SNAPSHOT/
I will give feedback here.
trhsrw commentedon Jun 14, 2018
The problem persists. I have checked the output of ng --version. That's kind of strange with ASCII art. I don't know, whether there is a variant of the --version option without ascii art. You won't be able to fix this as long as they keep playing around with crap like that in their version output.
You might want to consider a boolean option (checkbox) in the preferences / the new project dialog to skip CLI validation. Or something like: "use ng.cmd anyway, I know, what I'm doing." This might help most people with a standard installation of angular cli.
angelozerr commentedon Jun 14, 2018
Thanks for your feedback @trhsrw . I agree with you, this version search must perhaps be less restrictive. I must find time to study this problem and do something.
JJN2 commentedon Jun 19, 2018
I found a solution to "The 'ng' is not a ng file." problem. You have to have ng set in your $PATH before starting Eclipse IDE. After that you should be able to create new Angular projects with angelo's plugin, since the plugin should find ng from $PATH (global _preferences).
For example: on your ~/.profile (or where ever your $PATH is set) file
PATH="$PATH:/usr/lib/node_modules/@angular/cli/bin"
Change Angular path to match your installation.
So this 'bug' seems to be more related to configuration.. Maybe this 'Global preference' should be editable so plugin would use users configuration instead of $PATH (if it is not found from $PATH)
On Windows $PATH would mean your Environment variables...
I hope this helps.. it solved my case of "The 'ng' is not a ng file."
I'm using:
Linux, Eclipse Oxygen 4.7.3a, Node.js 8.11.3, Angular CLI 6.0.8
JJN2 commentedon Jun 19, 2018
PATH="$PATH:/usr/lib/node_modules//bin" --> PATH="$PATH:/usr/lib/node_modules/@angular/cli/bin"
Sorry for that typo in example PATH setting
JJN2 commentedon Jun 19, 2018
ah.. special character which is parsed away from text.. well anyways.. set Angular path in there.
probert94 commentedon Jun 19, 2018
@JJN2 If you select
global cli, you should haveangular-cliinstalled globally, by usingnpm install @angular/cli -g. This should install it in the globalnode_modules, which should be part of the path by default.Basically, the plugin just executes
ng --version, to check if a validangular-cliversion is available. If theng-command is not part of the path, then it won't be able to execute it.Usually, it is a good idea to install
angukar-cliglobally, if you are developing applications with it, because otherwise you won't be able to execute all theng-commands easily.JJN2 commentedon Jun 19, 2018
Angular was installed globally with -g flag (as instructed in Angular web pages). It was globally usable since ng commands could be run from any folder location but $PATH settings were never modified by npm install -g ...
Problem was that angular path was not defined in $PATH which is set by default in ~/.profile on Debian Jessie distro of Linux. Eclipse plugin for some reason needs Angular path defined in $PATH or it won't find ng at all when using Global preferences.
TheCrazyT commentedon Oct 28, 2018
Problem is that the embedded nodejs is used inside the $PATH.
You probably need to setup an external path for nodejs-first because the newest "@angular/cli" is not compatible with the embedded nodejs that gets used.
The plugin uses embedded 6.9.4 by default wich won't work with the ng-command.
garymazz commentedon Sep 29, 2019
I'm having the same problem 1 year later.
I've configured ng global
Angular CLI: 8.3.6 is installed globally.
Directory C:\Program Files\nodejs is in the path..
I've also configured to use "installed" node.js 10.16.3 in directory C:\Program Files\nodejs with same results.
Is there a fix/work around for windows 10?
trhsrw commentedon Sep 29, 2019
@garymazz: I ended up using the Eclipse WildWebDeveloper plugin (strongly recommended anyway) and the Angular CLI in Eclipse‘s terminal view. Works best for my purposes.