micha / jsawk

Like awk, but for JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsawk: line 1118: js: command not found

jinjiru opened this issue · comments

EDITED:
Oooops, my bad! I've forgotten to install js :) Shame on me!
Please disregard this issue!

Thanks a lot!


Hi!
I'm trying to use jsawk under MacOS X, but I am getting the following error:

PM0270:~ lyubovberezina$ curl -s "https://api.github.com/repos/antirez/redis" | jsawk "return this.open_issues"
/usr/local/bin/jsawk: line 1118: js: command not found

Thanks!

recently, i got exacly the same issue.
can you tell me, how you installed js?
is there a package for easy apt-get installation?

@Killerbear according to the Readme just install the spidermonkey-bin package for it.

@micha On Arch, when installing js from extra, it gives you js17 command and not js. I am having to do ln -s /usr/bin/js17 /usr/bin/js to run jsawk. =\

It seems reasonable to have a js command on your system, so the symlink seems like the right thing to do. Would you say that jsawk should try to accommodate js17 as well as js?

@micha well, i am not sure really. most distro would use whatever version symlinked to the command as I did. It would depends how often js is updated and what other packages provide as a replacement for it.

My fear is linking to js17 would stick with that version of the package. If you're fine with it then go for it. I just don't want to break other packages/distros over some upgraded packages.

@flamusdiu Perhaps a command line argument that lets you pass in the spidermonkey binary name? Then Arch users can use an alias in their shell to do that. Alternatively, maybe an environment variable would be appropriate?

Looks like Debian uses smjs ... umm ... I guess you could do some kinds of distro check to know the binary name then you could use some like of var ${spidermonkey_bin} to replace it in your code or you could just create the symlink from the binary (after you find it) to js. Not sure which is the more correct way though.

More information over at my repo and issue tracker on this issue here: flamusdiu/Chrome-Updater#4

@flamusdiu I don't think it's a good idea for jsawk to have to know things about different distros. That would be the job of whoever packages up jsawk for inclusion in those distros' package repos. I'll add the things we talked about so that the jsawk packager can set up a the /etc/jsawkrc file or whatever as they see fit. This makes sense also because it might depend on which js package is installed (if there are multiple ones available).

@micha I agree. Either of the 3 solution that we talked allows jsawk to work with all distros. Just make a note in the man about it. You can always default to js or whatever distro you primarily use function as well. But I leave that up to you. =D

@flamusdiu Sweet. I do it. Thanks for your advice and help!