title: Warning: PhantomJS not found
body: <p>I have installed nodejs 0.10.15 on debian 6. Using npm I have then installed:</p>
  
  <pre><code>sudo npm install grunt-cli -g
  </code></pre>
  
  <p>I have also executed npm install in my local test directory (downloading the necessary dependencies to the node_modules directory) which contains the following package.json file:</p>
  
  <pre><code>{
    "name": "sample-name",
    "version": "1.4.0",
    "devDependencies": {
      "grunt": "~0.4.1",
      "grunt-contrib-qunit": "&gt;0.0.0",
      "grunt-qunit-istanbul": "&gt;0.0.0"
    }
  }
  </code></pre>
  
  <p>here is the output when installing phantomjs:</p>
  
  <pre><code>...
  Writing location.js file
  Done. Phantomjs binary available at /home/myuser/Test/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/lib/phantom/bin/phantomjs
  Done. Phantomjs binary available at /home/myuser/Test/node_modules/grunt-qunit-istanbul/node_modules/grunt-lib-phantomjs-istanbul/node_modules/phantomjs/lib/phantom/bin/phantomjs
  grunt@0.4.1 node_modules/grunt
  ├── which@1.0.5
  ...
  </code></pre>
  
  <p>But when I run <strong>grunt test</strong> from the test dir I get:</p>
  
  <pre><code>Running PhantomJS...ERROR
  &gt;&gt; In order for this task to work properly, PhantomJS must be installed locally
  &gt;&gt; via NPM. If you're seeing this message, generally that means the NPM install
  &gt;&gt; has failed. Please submit an issue providing as much detail as possible at:
  &gt;&gt; https://github.com/gruntjs/grunt-lib-phantomjs/issues
  Warning: PhantomJS not found. Use --force to continue.
  </code></pre>
  
  <p>If I run the phantomjs script installed in the previous specified location nothing happens, I get exit code 127 though (indicating problem PATH :<a href="http://tldp.org/LDP/abs/html/exitcodes.html" rel="noreferrer">http://tldp.org/LDP/abs/html/exitcodes.html</a>). If I cat the phantomjs bash script it looks like this:</p>
  
  <pre><code>#!/usr/bin/env node
  
  var path = require('path')
  var spawn = require('child_process').spawn
  
  var binPath = require(path.join(__dirname, '..', 'lib', 'phantomjs')).path
  
  var args = process.argv.slice(2)
  
  // For Node 0.6 compatibility, pipe the streams manually, instead of using
  // `{ stdio: 'inherit' }`.
  var cp = spawn(binPath, args)
  cp.stdout.pipe(process.stdout)
  cp.stderr.pipe(process.stderr)
  cp.on('exit', process.exit)
  
  process.on('SIGTERM', function() {
    cp.kill('SIGTERM')
    process.exit(1)
  })
  </code></pre>
  
  <p>As I understand this means that phantomjs is executed inside node. If I start node enter the path var I get:</p>
  
  <pre><code>:~$ env node
  &gt; var path = require('path')
  undefined
  &gt; 
  </code></pre>
  
  <p>(which I understand is default behavior: <a href="https://stackoverflow.com/questions/8457389/node-js-displays-undefined-on-the-console">node.js displays &quot;undefined&quot; on the console</a>)</p>
  
  <p>Any suggestions to further debug this problem?</p>