phantomJsPath incorrectly calculated on Vagrant installation
listenrightmeow opened this issue · comments
Problem
- OSX : /usr/local/bin/phantomjs
- Vagrant (Ubuntu 14.04) : /usr/bin/phantomjs
I leverage all of my grunt tasks through OSX for local development, criticalCSS is working flawlessly on OSX. When I enter a shell session on my vagrant installation, phantomJsPath is referencing my OSX installation directory. With the incorrect path being calculated, I cannot test my grunt task before inserting into application automation.
Solution
Run cli command 'which phantomjs' to avoid cross-platform issues when testing/debugging application automation support with grunt tasks.
https://gist.github.com/listenrightmeow/7469e43bbbc13033f19e
https://github.com/listenrightmeow/criticalCSS
So, this is most definitely an issue with two different environments/setups, one installer to rule them all (the node phantomjs installer).
I need to think on this, but unfortunately we can't jump on using which
because it's not available on Windows and this tool needs to be cross-platform.
A quick fix, but likely one you don't want, is to:
- Wipe out your
node_modules
folder - Wipe out your global installations of
phantomjs
- Run
npm install
again
This will install phantom in the node_modules
directory, allowing it to be referenced locally to the project.
I know that's not a great solution, but it might work for you.
Thanks @jefflembeck, a solution is a solution!
I've opted for your approach, but for anybody else that may have this issue will need to delete criticalcss from the node_modules directory and install separately on OSX/Ubuntu to run this on both sides of the fence.
I think your team still has access to our team repo that I granted you guys back in January, https://github.com/tradesy-oss/grunt-criticalcss-server is the solution for your team's feedback for criticalcss. We appreciate the hard work!