Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show in local terminal should update PATH #93

Open
rubensa opened this issue Jul 7, 2017 · 10 comments
Open

Show in local terminal should update PATH #93

rubensa opened this issue Jul 7, 2017 · 10 comments

Comments

@rubensa
Copy link

rubensa commented Jul 7, 2017

If you:
Select project in Project Explorer ---> Right Click --> Show in local Terminal --> Terminal
the new terminal windows does not have PATH variable updated.

When creating an Angular Project, there is issued a command that sets the PATH environment variable to include node path (I think there is a bug here as, at least if you have configured embedded node.js, seems to include the path to node executable not to the bin directory that contains node executable an npm link -so for creating the project is using my global configured node.js, not the specified "embedded" one-) and project node_modules/.bin directory.

I think that, if possible, this setup should be issued "always" when opening a terminal for the project or, at least, provide a way to do it "alone" (as you can "force" an AngularCLI run that also opens a new terminal with the PATH updated -in this case the path includes the embedded node bin directory, not only the executable, which I think is the right way-).

@rubensa
Copy link
Author

rubensa commented Jul 7, 2017

From Terminal opened when creating the project (global node.js installed version):

~/development/eclipse/4.7.0_base/workspace/prueba$ node --version
v6.11.0

From Terminal opened when performing a "Run as" --> "ng build" (built in version):

~/development/eclipse/4.7.0_base/workspace/prueba$ node --version
v6.9.4

@angelozerr
Copy link
Owner

angelozerr commented Jul 7, 2017

(I think there is a bug here as, at least if you have configured embedded node.js, seems to include the path to node executable not to the bin directory

Tried to fix it, tell me if it's OK for you.

If you:
Select project in Project Explorer ---> Right Click --> Show in local Terminal --> Terminal
the new terminal windows does not have PATH variable updated.

I know this problem. The problem is that TM terminal project doesn't provide an extension point kind to intialize PATH env before terminal is opened.

Today PATH are initialized by the wizard which opens the terminal. Perhaps we could create our own Show In to initialize PATH according the project settings?

@angelozerr
Copy link
Owner

From Terminal opened when creating the project (global node.js installed version):

~/development/eclipse/4.7.0_base/workspace/prueba$ node --version
v6.11.0

From Terminal opened when performing a "Run as" --> "ng build" (built in version):

~/development/eclipse/4.7.0_base/workspace/prueba$ node --version
v6.9.4

Yes it's normal, launch initialize PATH with embed dir. You can check the PATH variable once terminal is opened.

@rubensa
Copy link
Author

rubensa commented Jul 7, 2017

Just installed again from http://oss.opensagres.fr/angular2-eclipse/1.3.0-SNAPSHOT/ but same result...

On Terminal oppened to create the project:

~/development/eclipse/4.7.0_base/workspace/prueba$ node --version
v6.11.0
~/development/eclipse/4.7.0_base/workspace/prueba$ echo $PATH
/home/rubensa/development/eclipse/4.7.0_base/workspace/.metadata/.plugins/ts.eclipse.ide.server.nodejs.embed.linux.gtk.x86_64/node-v6.9.4-linux-x64/bin/node:/home/rubensa/development/eclipse/4.7.0_base/workspace/prueba/node_modules/.bin:/home/rubensa/software/node/bin:/home/rubensa/software/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Could be network cache problem on my side or just not "really" fixed?

@angelozerr
Copy link
Owner

Update site was not built. Please wait for that following job https://opensagres.ci.cloudbees.com/job/angular2-eclipse/311/ is finished.

@rubensa
Copy link
Author

rubensa commented Jul 7, 2017

Now it work like a charm!

Thanks @angelozerr !!

NOTE:

Today PATH are initialized by the wizard which opens the terminal. Perhaps we could create our own Show In to initialize PATH according the project settings?

I thinks It should be a good solution (as running a ng build is not so intuitive to open a new Terminal with the right PATH).

NOTE2: And what about "reuse" existing (if that is the case) Terminal used for previous execution and not opening a new one?

@angelozerr
Copy link
Owner

I thinks It should be a good solution (as running a ng build is not so intuitive to open a new Terminal with the right PATH).

You don't like use launch to do ng build? Please not you can execute ng build by opening .angular-cli.json file

image

An another idea is to provide ng build, tests, etc as children of the .angular-cli.json the project explorer like the scripts of package.json:

image

Please create new issue if you like this idea.

And what about "reuse" existing (if that is the case) Terminal used for previous execution and not opening a new one?

It should work like this. If you redo a ng build, it should use the same terminal, no?

@rubensa
Copy link
Author

rubensa commented Jul 7, 2017

You don't like use launch to do ng build?

No, I said that if I only want to open a terminal (but with the right PATHs set), It is not easy to guess that I must execute an ng command (using Eclipse). Other way, If y open a new Terminal, the PATH is not set.

It should work like this. If you redo a ng build, it should use the same terminal, no?

Not exactly. I think that there should be one Terminal linked with one Angular Project. If there is currently a linked Terminal opened, reuse. If there is no one (never opened or just closed), create a new one and link with the project (for future re-use). I'll create a new issue for this.

@probert94
Copy link
Contributor

As there is now way to configure the Terminal, opened by "Show in Local Terminal", I guess it would be the best to provide a custom "Open in Terminal" for the plugins.
This command could set the correct PATH and probably. It would also allow us to customize behavior in future, if needed, as we are in control of that terminal.

@rubensa
Copy link
Author

rubensa commented Jul 11, 2017

New update on these.

It seems that some of the latter changes broke the PATH setup as for now (when Run As --> ng build) It doesn't include current project "node_modules/.bin" directory in the PATH. Only ".metadata/.plugins/ts.eclipse.ide.server.nodejs.embed.linux.gtk.x86_64/node-v6.9.4-linux-x64/bin" is included before current PATH.

Didn't notice the change till now that I closed all Terminal's and tried to open a new one.

UPDATE!!:
Created a new Angular Project, closed all Terminal's, Run As --> ng build, and the PATH is correct!!!.
Checked again the projects I created yesterday.
One works (set the PATH) and two don't (only node bin directory).
Trying to identify the problem I realized that there is no ./settings/ts.eclipse.ide.angular2.cli.prefs file (which found contains the ngCustomFilePath) in not working projects.
How/When was this file removed???
To fix it I had to: Right click project --> Properties --> TypeScript --> Angular --> CLI:

  • Check Enable project specific settings
  • Check Use ng custom installation: ${project_loc:node_module/.bin}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants