I have installed nodejs 0.10.15 on debian 6. Using npm I have then installed:
sudo npm install grunt-cli -g
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:
{
"name": "sample-name",
"version": "1.4.0",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-qunit": ">0.0.0",
"grunt-qunit-istanbul": ">0.0.0"
}
}
here is the output when installing phantomjs:
...
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
...
But when I run grunt test from the test dir I get:
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.
If I run the phantomjs script installed in the previous specified location nothing happens, I get exit code 127 though (indicating problem PATH :http://tldp.org/LDP/abs/html/exitcodes.html). If I cat the phantomjs bash script it looks like this:
#!/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)
})
As I understand this means that phantomjs is executed inside node. If I start node enter the path var I get:
:~$ env node
> var path = require('path')
undefined
>
(which I understand is default behavior: node.js displays "undefined" on the console)
Any suggestions to further debug this problem?