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

Failed to install... Need documentation update #67

Closed
milipili opened this issue Jul 2, 2017 · 7 comments
Closed

Failed to install... Need documentation update #67

milipili opened this issue Jul 2, 2017 · 7 comments

Comments

@milipili
Copy link

milipili commented Jul 2, 2017

$ npm install -g node-deb
$ node-deb
Error: Cannot find module 'jq'
sudo npm install -g jq

recursive calls?
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/lib/node_modules/jq/node_modules/contextify/.node-gyp/8.1.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/jq/node_modules/contextify/.node-gyp"

Need to be run twice to do the job
$ node-deb
Error: Cannot find module 'commander'
$ sudo npm install -g commander
$ node-deb
Error: Cannot find module 'async'
$ sudo npm install -g async
$ node-deb
Error: Cannot find module 'rimraf'
Error: Cannot find module 'winston'
Error: Cannot find module 'colors'
@milipili
Copy link
Author

milipili commented Jul 2, 2017

Actually, the dependencies are just missing..

@heartsucker
Copy link
Owner

Hey @milipili jq is actually a binary you can get from apt or brew.

$ node-deb
Error: Cannot find module 'commander'
$ sudo npm install -g commander
$ node-deb
Error: Cannot find module 'async'
$ sudo npm install -g async
$ node-deb
Error: Cannot find module 'rimraf'
Error: Cannot find module 'winston'
Error: Cannot find module 'colors'

I'm not sure where that error came from since node-deb is just an oversized bash script. It shouldn't be calling node ever or running and JS files. I'm not what's going on there. Can you do a vim $(which node-deb) and add the flag set -x to the top of the script. Then run it again and copy/paste the output to a Gist. Maybe that can help me debug.

@milipili
Copy link
Author

milipili commented Jul 3, 2017

Hum I've installed jq via npm. After I've installed the deps it started but I was unable to make it work anyway (some exceptions somewhere).
I forgot to give my os: debian 9 stretch. nodejs installed via ppa (don't know if it changes anything).
Finally I've made the package manually. It. But I can retry on a fresh debian

@heartsucker
Copy link
Owner

It looks like the npm package jq is just jQuery whereas the binary I'm talking about is this:
https://stedolan.github.io/jq/

I understand that it's a bit odd to use something other than node to process the JSON, but when I made this I was doing sys-admin work and just needed some bash to handle packing my company's apps for deployment. I could conceivably rewrite it in JS, but that's a whole 'nother issue.

heartsucker@pythagoras:~ (master)$ jq --version
jq-1.5-1-a5b5cbe

If you don't see that output, then you might have to uninstall whatever jq you installed with npm as it may have higher PATH precedence than your apt/brew packages.

@milipili
Copy link
Author

milipili commented Jul 3, 2017

It is probably fine to install another package (even if loading json in js is a piece of cake so I don't really understand...). But the documentation should be updated. Because there is no way to guess why it does not work (well, or won't bother, like me today since I didn't have time for that)

@heartsucker
Copy link
Owner

From the README (which is also available via node-deb --show-readme):

Requirements

  • dpkg
  • fakeroot
  • jq

These are all available through apt and brew.

And yes, loading JSON in JS is trivially easy (or I assume it is), but I actually don't know any JS/Node and I wrote this as an admin who just wanted our deploys to be a little less messy. If I had to write this in JS, it probably wouldn't have ever existed. Such is life in the imperfect world of FOSS.

It is admittedly odd to use jq over writing it in JS, but this is the first time someone has had enough of a problem to say something in ~2 years.

If you think this is a deficiency of node-deb, please open a separate ticket so people can discuss the change to JS. As it is, whenever I make changes, I usually end up breaking other people's CI or workflow, and I try to be sensitive to that. Changing to adding a hard requirement on node warrants public discourse before deciding which way to go.

Because there is no way to guess why it does not work

And to be fair, there's not really any way to reliably predict that someone has the wrong binary executing from their path. In theory, you could install your own version of curl or node or anything else, and then we're in an extremely complex space where every script has to error check every shell command to ensure that the binary executing actually is the binary it thinks.

I have updated the README with commit 7d914f9 to include a link to the correct jq should someone else have a similar issue.

@milipili
Copy link
Author

milipili commented Jul 4, 2017

Well, first, if there is some documentation, people can figure out why it does not work as expected. So this ticket can be closed I guess.
That said, from a js point of view, I think indeed jq should be replaced by pure js.

@milipili milipili closed this as completed Jul 4, 2017
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

2 participants