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

Wasn't able to find node on my system #1

Closed
codeincontext opened this issue Jun 26, 2016 · 15 comments
Closed

Wasn't able to find node on my system #1

codeincontext opened this issue Jun 26, 2016 · 15 comments

Comments

@codeincontext
Copy link

codeincontext commented Jun 26, 2016

Hi, thanks for this. Super cool.

I had to tweak some things to get this to work. Don't know if it's my environment but could be useful to know. It wasn't working, I turned on the debug output and got this:

[2016-06-26 21:21:33][ERROR: input.scriptfilter] Code 127: bash: no job control in this shell
/Users/adz/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Scripts/F7C3D82A-57F6-4032-92FF-E179415ACB0D: line 2: node: command not found

The fist line seems to be ignorable. The second not so much. I changed the script to point to my node (which node) which fixed it

/usr/local/bin/node index.js "$1"

Thanks!

@sindresorhus
Copy link
Owner

What output do you get if you add in foo=$($(echo $SHELL) -ic 'echo $PATH');echo $foo in the workflow?

@codeincontext
Copy link
Author

/usr/bin:/bin:/usr/sbin:/sbin:/Users/adz/.fzf/bin

@sindresorhus
Copy link
Owner

Hmm, weird.

Can you try replacing the script with:

PATH=$($(echo $SHELL) -ic 'echo $PATH'):/usr/local/bin:$PATH
node index.js "$1"

What's the output when running these commands in your Terminal (not in the Alfred workflow):

  • echo $SHELL
  • bash --version
  • zsh --version
  • echo $PATH

@codeincontext
Copy link
Author

That works

Don't think it should matter but FWIW I normally use Fish

Adams-MBP-4:~ adz$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
Adams-MBP-4:~ adz$ zsh --version
zsh 5.0.8 (x86_64-apple-darwin15.0)
Adams-MBP-4:~ adz$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

@sindresorhus
Copy link
Owner

So Fish is your default shell? Do you know the Fish equivalent of echo $($(echo $SHELL) -ic 'echo $PATH')? (That snippets spawns your default shell interactively and get's your $PATH.) I would guess it doesn't work because you default shell is Fish and it tries to spawn Fish with unsupported flags and syntax.

0.1.1 is out with the fix btw. http://www.packal.org/workflow/emoj

@codeincontext
Copy link
Author

I should have been clearer; bash is still my default shell for compatibility reasons, but I don't use it often and it may not be configured in a typical way. I think Alfred hard codes /bin/bash anyway

And cool, thanks sir

@sindresorhus
Copy link
Owner

Ok, cool :)

Last favor. Could you replace it with this and see if it still works?

eval $(/usr/libexec/path_helper -s)
export PATH=/usr/local/bin:$($(echo $SHELL) -ic 'echo $PATH'):$PATH

node index.js "$1"

Just want to ensure I don't break it again.

@codeincontext
Copy link
Author

Yep, still works ✔✅🔜👌➡👍☑😌🔄🙌

On Sun, Jun 26, 2016 at 10:36 PM Sindre Sorhus notifications@github.com
wrote:

Ok, cool :)

Last favor. Could you replace it with this and see if it still works?

eval $(/usr/libexec/path_helper -s)export PATH=/usr/local/bin:$($(echo $SHELL) -ic 'echo $PATH'):$PATH

node index.js "$1"

Just want to ensure I don't break it again.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAFj6xxq2X8AHzdA5D2O587qUNVIs_ONks5qPvDYgaJpZM4I-okB
.

@sindresorhus
Copy link
Owner

👍👌😃😄😀👏😎😊😁

@CWSpear
Copy link

CWSpear commented Jun 28, 2016

@sindresorhus does it solve anything by using something like enclose.js? to package your module as a binary? I was able to package the script from this repo. It was about 15 MB. Could this be a workaround cuz then we wouldn't need to know PATH? And since you're only targeting Macs, it's okay if it's only compiled for Macs.

@sindresorhus
Copy link
Owner

@CWSpear Last resort maybe, but hope it doesn't get to that.

@CWSpear
Copy link

CWSpear commented Jun 29, 2016

Why is that a last resort?

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 29, 2016

Because it's 15 MB, and while I don't mind that, people will complain and call it a waste of space. I also think I can fix it without, so at least gonna try. Packaging as a binary surely come with its own quirk and problems too.

@sindresorhus
Copy link
Owner

But most importantly, users don't like installing random binaries and not seeing what kind of source they're running.

@CWSpear
Copy link

CWSpear commented Jun 29, 2016

The source is on GitHub, and people are welcome to download and build themselves (or at least if you trust the developer, just check the checksum). I think it's a valid concern, but I don't know if it's really something that is your responsibility.

I mean, there are lots of tools/languages/other places that package binaries and stuff (having dabbled in Go, that's all you do!). I can't speak for everyone, but I think the advantages of "just works" and not having to deal with "works in my environment but not yours" greatly outweighs that.

Anyway, it's your project, and I know you deal with a ton of projects and issues. I just wanted to offer the suggestion hoping it might help. I definitely won't be offended if you don't take the suggestion =)

Thanks for all your awesome work in the Node et al community!

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