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

$PATH only present when Atom is launched from command line #150

Closed
dmnd opened this issue Aug 4, 2014 · 73 comments
Closed

$PATH only present when Atom is launched from command line #150

dmnd opened this issue Aug 4, 2014 · 73 comments

Comments

@dmnd
Copy link

dmnd commented Aug 4, 2014

When Atom is launched from the command line with atom, it has access to $PATH as defined by the shell so the linter can often find executables.

But if Atom is launched via the dock, Spotlight, Applications folder, or other GUI method, it does not inherit $PATH. This means that linters will fail to find their executables. I bet this problem is behind a lot of the bug reports that see the spawn ENOENT message.

@smlombardi
Copy link

This happens to me whether or not i open from command line. Atom 136 and OS 10.10 GM3.

@ryanleary
Copy link

Same here. Atom 136 and 10.10 (14a388b).

@smlombardi
Copy link

Now I have suppressed the error by reinstalling the gems. But the scss
linter is not doing anything.

On Tuesday, October 14, 2014, Ryan Leary [email protected] wrote:

Same here. Atom 136 and 10.10 (14a388b).


Reply to this email directly or view it on GitHub
#150 (comment).

@nsrosenqvist
Copy link

Is anyone working on this? It makes the linter-shellcheck plugin useless since everytime a file is opened the console opens up with the error.

@dmnd
Copy link
Author

dmnd commented Nov 4, 2014

I upgraded to Yosemite and now Atom doesn't seem to inherit the $PATH from the shell I launch atom from. So this issue is now pretty important to fix.

I started working on it a while ago but never finished it. But since my linter is now broken, I'll fix this issue on the weekend.

@dmnd dmnd self-assigned this Nov 4, 2014
@bolinfest
Copy link

As a workaround for electron/electron#550, consider:

    commandString = 'your command to run a linter';
    if (process.platform === 'darwin') {
      // OS X apps don't inherit PATH, so reconstruct it. This is a bug, filed
      // against Atom here: https://github.com/atom/atom-shell/issues/550
      commandString = 'eval `/usr/libexec/path_helper -s` && ' + commandString;
    }

@dmnd
Copy link
Author

dmnd commented Nov 16, 2014

Atom v0.142.0 fixed the issue where opening from the command line didn't inherit $PATH. So now this issue only occurs when launching from the GUI. Would still be nice to fix, but not as critical.

@dmnd dmnd removed their assignment Nov 16, 2014
@gbersac
Copy link

gbersac commented Nov 21, 2014

I am on ubuntu and the error fire even when launched from command line, even after adding the :

process.env.PATH = ["/usr/local/bin", process.env.PATH].join(":")

line in init.coffee

@partydrone
Copy link

If I launch Atom from the command line, I don't have any issues. But I usually launch it from GitHub for Mac, which causes problems—specifically with rubocop.

@jacebot
Copy link

jacebot commented Dec 15, 2014

This still occurs when launching from Terminal or Gui on Mac OS (Yosemite)

Uncaught BufferedProcessError: Failed to spawn command pep8. Make sure pep8 is installed and on your PATH
Uncaught BufferedProcessError: Failed to spawn command pylint. Make sure pylint is installed and on your PATH

/Users/MyMacUsername/Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:100

@alexbet
Copy link

alexbet commented Dec 29, 2014

Some thing happens for me as Jacebot above.

Uncaught BufferedProcessError: Failed to spawn command phpcs. Make sure phpcs is installed and on your PATH /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:104
Uncaught BufferedProcessError: Failed to spawn command phpmd. Make sure phpmd is installed and on your PATH /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:104
Uncaught BufferedProcessError: Failed to spawn command phpcs. Make sure phpcs is installed and on your PATH /Applications/Atom.app/Contents/Resources/app/src/buffered-process.js:100
Uncaught BufferedProcessError: Failed to spawn command phpmd. Make sure phpmd is installed and on your PATH

@MatthewHerbst
Copy link

I also just encountered this issue.

Using: OSX Mavericks 10.9.5, Atom 0.165.0

I launched Atom initially from the dock and edited some files. I then opened another file in Atom from the command line atom myfile and got this error (as well as console opening with the error):

Uncaught BufferedProcessError: Failed to spawn command `shellcheck`. Make sure `shellcheck` is installed and on your PATH 

@davidawad
Copy link

Confirmed as well, Ubuntu 14.10 on MacBook Air 2013

@chrisandrewcl
Copy link

Hey guys,

process.env.PATH = ["/usr/bin",
                    "/usr/local/bin"].join(":")

also tried

process.env.PATH = ["/usr/bin",
                    "/usr/local/bin",
                    process.env.PATH].join(":")

to my ~/.atom/init.coffee didn't work. I also noted that Atom when started from command line works fine but didn't when started from my Xubuntu panel, so I edited the Atom shortcut (laucher) in my panel and changed the command from /opt/atom/atom %F to bash --login -c "atom", as suggested above.

Now all my ruby related packages are working!

@davidawad
Copy link

@Trefex THANK YOUUUU. YOU HAVE SOLVED MY LIFELONG STRUGGLE WITH THIS EDITOR.

@ssfrr
Copy link

ssfrr commented Aug 5, 2015

It seems that init.coffee isn't run until after packages are loaded, so if one of your packages tries to spawn a shell command that's not on your default $PATH then it still doesn't work. As fas as I can tell the only alternative in that case is tweaking the launcher to run Atom from within a shell environment.

@rennsport
Copy link

I'm running OS X 10.10.5 and Atom 1.0.9 and I'm having this issue both launching from GUI and terminal. Are there any other solutions other than editing the init.coffee because that doesn't seem to work for me.

@steelbrain
Copy link
Owner

@rennsport why not specify a path to the executable in linter config?

@rennsport
Copy link

@steelbrain So my linter directory is /Users/[user]/.atom/packages/linter what file would I need to edit because none are standing directly out as a config file.

@steelbrain
Copy link
Owner

@rennsport You won't need to edit any file for this, just goto settings view, the linter provider you want to specify executable for, and there should be a field for it.

@rennsport
Copy link

@steelbrain My linter provider doesn't seem to have those options in settings

@steelbrain
Copy link
Owner

@rennsport that is the base linter you are pointing at, by a "provider", I meant packages like "linter-jshint", "linter-eslint" and "linter-flake8"

@rennsport
Copy link

@steelbrain I feel slightly less capable now as I linked this project within the project itself without realizing it haha. Sadly however, the actual linter provider does not have such settings unless I'm missing something obvious again.

Edit: Under the configuration I am told I need to set the Executable Path, but there is no option for that and I'm not sure what file I would add it to.

@steelbrain
Copy link
Owner

@rennsport It does have that setting and it's called executable, see https://github.com/AtomLinter/linter-pylint/blob/master/lib/main.coffee#L9
but if you are unable to see it for some reasons, then I would suggest you try this and let me know the results of it

mv ~/.atom ~/.atom-bkp
apm install linter
apm install linter-pylint

@rennsport
Copy link

@steelbrain I now see said settings. Maybe the theme I was using hid them? Anyways I have now gotten around the first error, and I have a second (I apologize for my novice understand of this). Error: "Traceback (most recent call last):" I can show the full error in a pastebin or something similar.

@steelbrain
Copy link
Owner

@rennsport can we please chat in the atom slack or at least in a separate issue, I have to open up this super-long page each time and tons of people are notified each time via email/push.

@anildigital
Copy link

In linter-rubycop plugin,

I have rubocop command set like this.

/Users/anil/.gem/ruby/2.2.4/bin/rubocop

But when I open Ruby project from Atom menu File -> Open.., it gives me following error

Error: /Users/anil/.rubies/ruby-2.2.4/lib/ruby/2.2.0/rubygems/dependency.rb:315:in to_specs': Could not find 'rubocop' (>= 0) among 229 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/anil/.gem/ruby/2.2.0:/Users/anil/.rubies/ruby-2.2.4/lib/ruby/gems/2.2.0', executegem envfor more information from /Users/anil/.rubies/ruby-

But when I open project from command like like atom . I don't see this error.

My Atom version is 1.3.2 and I am using El Capitan.

@Arcanemagus
Copy link
Collaborator

This is an issue that is planning on being solved in Atom (see atom/atom#4126), with a temporary workaround planned in steelbrain/atom-linter#62 for linter plugins that utilize the atom-linter package. For any that don't they will need to work around this limitation on their own.

I'm locking this issue as it hasn't been the proper repository for this issue for a very long time in the first place, and any further work on resolving the issues presented here will be done in the linked issues.

For any users on OS X until a workaround for Apple's "interesting" decision is put in place, the simplest method is to launch Atom from a terminal that has a full environment set up using atom ..

Repository owner locked and limited conversation to collaborators Dec 28, 2015
@steelbrain
Copy link
Owner

Here's an announcement for you, we have recently published a release of atom-linter (npm helper module for linter providers) that now automatically determines $PATH even if atom is not launched from terminal. Therefore all linters using it for execution, once updated to the new version, will be working consistently from both dock and CLI.

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

No branches or pull requests