Bernard Igiri
Bernard Igiri

Reputation: 1290

How do you install grunt-contrib-qunit in Ubuntu server 12.04 64?

I have a grunt project with the following npm dependancies:

I created an Ubuntu 12.04 64 bit server in VirtualBox VM (from an Ubuntu host) and ran the following commands:

sudo apt-get update
sudo apt-get install -y ruby rubygems gcc python make
sudo gem install compass

wget http://nodejs.org/dist/v0.10.15/node-v0.10.15.tar.gz
tar -xzf node-v0.10.15.tar.gz
cd node-v0.10.15/
./configure 
make
sudo make install
cd ../
rm -Rf node-v0.10.1
rm node-v0.10.15.tar.gz 

sudo npm install -g grunt-cli

Supposedly that installed npm. Then I used git clone to clone a grunt project that I was using in CentOS (it all works in CentOS). Unfortunately when I ran grunt it failed when trying to run qunit with the following error:

Running "qunit:dist" (qunit) task Testing /home/testuser/myproject/test/index.html OK

Running PhantomJS...ERROR

In order for this task to work properly, PhantomJS must be installed locally via NPM. If you're seeing this message, generally that means the NPM install has failed. Please submit an issue providing as much detail as possible at: https://github.com/gruntjs/grunt-lib-phantomjs/issues Warning: PhantomJS not found. Use --force to continue.

Aborted due to warnings.

I even ran npm update from the grunt folder and it still has this error.

What am I missing?

edit Please note the following facts:

  1. This project works in CentOS without error.
  2. This project has all of the plugin's installed locally using --save-dev
  3. Overwriting the local installs by installing each dependency manually does not fix this issue.
  4. Uninstalling and reinstalling each dependency manually does not fix this.

Upvotes: 0

Views: 2357

Answers (2)

badsyntax
badsyntax

Reputation: 9650

You need to run npm install from the root of your project to install the npm dependencies.

[EDIT] - After doing some more research, and after replicating this issue on a basic Ubuntu 12.04 install, I've finally figured out this issue.

The dependency chain is as follows:

grunt-contrib-qunit >> grunt-lib-phantomjs >> phantomjs

Now the phantomjs package simply installs a local version of phantomjs, and provides a JS api wrapper around the bin application. The problem is that phantomjs has certain OS level dependencies, as mentioned in the download page:

"... . It is however expected that some base libraries necessary for rendering (FreeType, Fontconfig) and the basic font files are available in the system."

And this is the reason why the local phantomjs install failed. Actually, the error is very generic as the install completes successfully, but phantomjs is not able to run.

The phantomjs NPM module does not handle phantomjs dependencies (as phantomjs is not a proper NPM module).

To fix the issue in Ubuntu 12.04, you need to manually install the phantomjs dependencies by installing the font packages with the following command:

sudo apt-get install fontconfig

I have created a ticket on the 'phantomjs' NPM project to add a note about these dependencies to the README: https://github.com/Obvious/phantomjs/issues/80

Upvotes: 5

Bernard Igiri
Bernard Igiri

Reputation: 1290

I just solved it.

sudo apt-get install phantomjs

After running that it works.

I found that after reading this: https://github.com/gruntjs/grunt-lib-phantomjs/issues/22

Upvotes: 0

Related Questions