when I execute casperjs, it throws an TypeError:
#casperjs test.js
child_process.js:936
var r = this._handle.spawn(options);
^
TypeError: Bad argument
at ChildProcess.spawn (child_process.js:936:24)
at exports.spawn (child_process.js:736:9)
at Object.<anonymous> (/usr/local/lib/node_modules/phantomjs/bin/phantomjs:22:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
and without test.js it throws same error:
# casperjs
child_process.js:936
var r = this._handle.spawn(options);
^
TypeError: Bad argument
at ChildProcess.spawn (child_process.js:936:24)
at exports.spawn (child_process.js:736:9)
at Object.<anonymous> (/usr/local/lib/node_modules/phantomjs/bin/phantomjs:22:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
casperjs was installed with following command refer to http://docs.casperjs.org/en/latest/installation.html#installing-from-npm:
$ npm install -g casperjs
thanks a lot in advance if any one can help on it.
Found the issue came from phantomjs:
#phantomjs hello.js
child_process.js:936
var r = this._handle.spawn(options);
^
TypeError: Bad argument
at ChildProcess.spawn (child_process.js:936:24)
at exports.spawn (child_process.js:736:9)
at Object.<anonymous> (/usr/local/lib/node_modules/phantomjs/bin/phantomjs:22:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
after reinstall phantomjs the issue was gone:
npm install -g phantomjs
A CDN site:
PHANTOMJS_CDNURL=http://cnpmjs.org/downloads npm install -g phantomjs
Both phantomjs and casperjs goes right:
# phantomjs -v
1.9.8
# phantomjs hello.js
Hello, world!
#casperjs test.js
百度一下,你就知道
The root cause seems to be that a broken phantomjs was installed before, when executed phantomjs it source the broken version.
Thanks the guys upping the questions. Wish this expierence will help others.
Best Regards -Radon