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
Related
There is a similar question on StackOverFlow but it was unhelpful and it wasn't answered. I have been working on a project and I currently am receiving this error.
Error: Cannot find module 'update-notifier'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
If I type any command that includes npm it returns the same error, I can't install anything.
I have tried to uninstall/re-install NodeJS with homebrew but nothing changed from trying that.
After updating VS 2015 to Update 2 gulp is failing executed by Task Runner Explorer, but it works fine from console.
The error is known, but I don't know how it is related to VS 2015. It does work well in VS 2013. Does VS using a different javascript interpreter than nodeJs or VS 2013 do?
It is a Windows 7, Node.js 5.10.1.
Error:
Failed to run "C:\..\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:\..\node_modules\gulp-inject\src\inject\index.js:127
startTag,
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:439:25)
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\..\node_modules\gulp-inject\index.js:4:28)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Failed to run "C:\..\package.json"...
Failed to run "C:\..\Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
C:\..\node_modules\gulp-inject\src\inject\index.js:127
startTag,
^
SyntaxError: Unexpected token ,
at Module._compile (module.js:439:25)
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 Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\..\node_modules\gulp-inject\index.js:4:28)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Update:
I have another machine with Windows 10, Node.js 5.10.1 and with Visual Studio 2015 Update 2 where the same stuff works fine
I had this problem recently too - I found updating VS to use my global node install fixed it for me:
https://github.com/VirtoCommerce/vc-community/issues/247#issuecomment-174454440
I had the same problem, but it turned out to be an issue of having an older version of NodeJS. I found this issue on github that helps:
https://github.com/klei/gulp-inject/issues/172
Once updated my NodeJS version to the latest, Gulp was working fine.
I'm writing unit-tests and run them with 'jasmine-es6'
and when I run them with simple jasmine command from cmd on my Windows 10 it's work fine.
However I made a super simple task for npm which looks like "test":"jasmine" but when I run npm test it's fails with following error:
C:\_projects\git\miestby>npm test
> miestby#0.0.1 test C:\_projects\git\miestby
> jasmine
C:\_projects\git\miestby\node_modules\babel-core\lib\babel\transformation\file\logger.js:45
throw new Constructor(this._buildMessage(msg));
^
ReferenceError: [BABEL] C:\_projects\git\miestby\test\app\common\list-pager.spec.js: Unknown option: presets
at Logger.error (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\transformation\file\logger.js:45:11)
at File.normaliseOptions (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\transformation\file\index.js:17
4:29)
at new File (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\transformation\file\index.js:152:10)
at Pipeline.transform (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\transformation\pipeline.js:127:16)
at Object.transformFileSync (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\api\node.js:118:37)
at compile (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\api\register\node.js:115:20)
at normalLoader (C:\_projects\git\miestby\node_modules\babel-core\lib\babel\api\register\node.js:166:14)
at Object.require.extensions.(anonymous function) [as .js] (C:\_projects\git\miestby\node_modules\babel-core\lib\bab
el\api\register\node.js:179:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\lib\jasmine.js:71:5
at Array.forEach (native)
at Jasmine.loadSpecs (C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\lib\jasmine.js:70:18)
at Jasmine.execute (C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\lib\jasmine.js:154:8)
at runJasmine (C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\lib\command.js:102:11)
at Command.run (C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\lib\command.js:49:7)
at Object.<anonymous> (C:\_projects\git\miestby\node_modules\jasmine-es6\node_modules\jasmine\bin\jasmine.js:11:9)
at Module._compile (module.js:425:26)
at Module._extensions..js (module.js:432:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\_projects\git\miestby\node_modules\babel-core\lib\bab
el\api\register\node.js:177:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at C:\_projects\git\miestby\node_modules\jasmine-es6\bin\jasmine.js:20:3
at FSReqWrap.cb [as oncomplete] (fs.js:216:19)
npm ERR! Test failed. See above for more details.
How to fix this error? One of my guess is that problem could be releated to npm permissions.
I'm using hapi-ninja, all is ok, and I would just run node server, but if I get these errors, I can not run it going to the route localhost:3000(Custom)
vagrant:/vagrant/hapi-ninja$ node server
module.js:340
throw err;
^
Error: Cannot find module 'boom'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/vagrant/hapi-ninja/node_modules/hapi/lib/index.js:3:12)
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 Module.require (module.js:364:17)
vagrant:/vagrant/hapi-ninja$
The error says it all: you need the module boom.
To install, type in a terminal
npm install boom
We are getting the following error while adding mosca = require("mosca") to my server.js script., any pointers here will be helpful. ^
Error: Cannot find module 'mosca/index.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/537dd88d5973ca6907000057/app-root/runtime/repo/server.js:8:15)
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)
DEBUG: Program node server.js exited with code 8
DEBUG: Starting child process with 'node server.js'
You need to install the package first:
npm install mosca
Better yet, install it and add it to your package.json:
npm install --save mosca
This is resolved now, Some how mosca module is not being installing, so I have installed locally and copied content to node_modules