flightplan-tool / flightplan

Search for award inventory using Node.js and Headless Chrome!
Apache License 2.0
142 stars 41 forks source link

Doesn't work on Ubuntu install #7

Closed ferni7 closed 5 years ago

ferni7 commented 6 years ago

Fresh Ubuntu 18 install with below then running flight plan search returns error. Related to the way you're calling commands with commander

andrew@FlightPlanVM2:~$ flightplan search

flightplan-search(1) does not exist, try --help

//Install NodeJS curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs

// Install Yarn curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn

// Install dependencies sudo apt-get install build-essential libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget

// Install flightplan-tool yarn global add flightplan-tool

// Add yarn bin folder to profil echo 'PATH="$HOME/.yarn/bin:$PATH"' >> .profile

mkdir flightplan cd flightplan flightplan search

jd20 commented 6 years ago

I took a closer look, what's throwing it off is that when installing flightplan with yarn, the bin symlink points to another symlink which points to the actual code. So, commander's logic is to only resolve the symlink once. This was probably a recent change in yarn behavior, and I'm not versed enough in Yarn to know why they did it (or if there's an easy way to turn it off), but I'm seeing the same problem with other Commander projects that use subcommands (when installed with yarn on Ubuntu).

I've filed https://github.com/tj/commander.js/issues/866, and will hopefully be able to put a fix together soon (it'll have to be fixed in CommanderJS). In the meantime, you could probably manually make the ~/.yarn/bin symlink point directly to flightplan's cli.js. Sorry for the inconvenience!

owine commented 5 years ago

Having this same issue on macOS.

Is this PR related to the underlying symlink issue?

https://github.com/tj/commander.js/pull/869

jd20 commented 5 years ago

Yes, same issue. My fix was very similar to @KillWolfVlad, except I wasn't using a 3rd party dependency. I had some simple bug in my loop logic though, so if tj/commander.js#869 works, I'll probably pull that into my fork (flightplan-tool uses my own forked version of commander.js, because of another issue I had to patch manually which I'm still waiting for them to merge and release). When I'm at my Ubuntu machine later, I'll test the patch.

jd20 commented 5 years ago

I've merged @KillWolfVlad's PR into my own fork, so flightplan-tool should now pick up the fix. Can you try a yarn global upgrade flightplan-tool (fix was added in 0.2.4), and report if the issue is fixed for you?

owine commented 5 years ago

Working on macOS. Thanks!