警告:PhantomJS找不到

我在Debian 6上安装了nodejs 0.10.15。然后我安装了npm:

sudo npm install grunt-cli -g 

我也执行了npm install在我的本地testing目录(下载必要的依赖到node_modules目录),它包含下面的package.json文件:

 { "name": "sample-name", "version": "1.4.0", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-qunit": ">0.0.0", "grunt-qunit-istanbul": ">0.0.0" } } 

这里是安装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 ... 

但是当我从testing目录运行grunttesting时 ,我得到:

 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. 

如果我运行安装在前面指定位置的phantomjs脚本,则不会发生任何反应,但是我得到了退出代码127(指示问题path: http : //tldp.org/LDP/abs/html/exitcodes.html )。 如果我捕捉phantomjs bash脚本,它看起来像这样:

 #!/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) }) 

据我所知这意味着phantomjs在节点内部执行。 如果我开始节点inputpathvar我得到:

 :~$ env node > var path = require('path') undefined > 

(我明白这是默认行为: node.js在控制台上显示“undefined” )

任何build议,以进一步debugging这个问题?

       

网上收集的解决方案 "警告:PhantomJS找不到"