Error running sample code using Spooky.js - node.js

I am new to the whole stack of node.js, phantom.js, casper.js and spooky.js. I have everything installed (in Windows), with PATH updated and followed this example:
https://github.com/WaterfallEngineering/SpookyJS
I got this error:
C:\node_modules\spooky>node examples/hello.js
events.js:68
throw arguments[1]; // Unhandled 'error' event
^
Error: Child terminated with non-zero exit code 127
at Spooky._spawnChild.Spooky._instances.(anonymous function) (C:\node_module
s\spooky\lib\spooky.js:82:17)
at ChildProcess.EventEmitter.emit (events.js:96:17)
at Process._handle.onexit (child_process.js:678:10)
Anyone has any clue why and how to fix it? I run casperjs googlelinks.js just fine. But with node.js and spooky.js, it gave me trouble.

This is due to the CasperJS Windows executable being named casperjs.bat instead of casperjs. See this comment on the bug #mike mentioned.
Unfortunately, you'll have to hack around this bug for the moment. I will release a fix for that this week.

This is based on the workaround provided by #mike and #lawnsea, which did lead me to the solution, but were not immediately clear to a beginner like me. The tip from minaki also helped me understand what to do: https://github.com/WaterfallEngineering/SpookyJS/issues/14
INSTALL SPOOKY.JS ON WINDOWS 7 WITH NPM.
I'm using:
Win7 64 bit
Node v0.10.17
CasperJS 1.1.0-DEV
PhantomJS 1.9.2
Added everything to my $PATH already
Steps:
Fresh directory: mkdir spookytest, cd spookytest
npm install spooky
open spookytest\node_modules\spooky\lib\spooky.js in a text editor
Change Line 26 (defaults.child.command) from 'casperjs' to 'casperjs.bat'
Change Line 30 (defaults.child.transport) from 'stdio' to 'http'
Save and go back to the spookytestdirectory
node node_modules/spooky/examples/hello.js
--> Hello, from Spooky the Tuff Little Ghost - Wikipedia, the free encyclopedia

Related

const INLINE = 'inline'; with npm related commands

Today I was trying to work on Angular2 (template https://akveo.github.io). As per installation guide, I ran following commands.
I have installed Node.js v6.9.1.
npm install --Worked fine.
npm server --Failed with below error.
E:\........\node_modules\script-ext-html-webpack-plugin\index.js:3
const INLINE = 'inline';
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
After many random searches and failing to resolve it, I decided to think about it with a calm head. To me it looks like it is a problem with ES2015/ES6. Package script-ext-html-webpack-plugin uses const variable which is a ES2016 feature. However system is unable to resolve it.
Also this problem can come with any package like hapi, selinium etc. But everything should have same solution I guess.
I have tried many related commands on the installation guide of the website mentioned above but nothing works and ends with same error. I have also many have faced same issue online but nothing concrete is visible as answer.
Could anyone help me out?
Update
Below approach has also fixed many of my colleague's machine who were facing some random errors with nodejs.
This problem is resolved in at least my machine. I am certainly not a person who understand nodejs completely but got it working after some googling. The solution given below may be common to many other issues I guess.
The system I am working has Windows 10 as Operating System and has 64 bit processor.
Go to control panel and uninstall nodejs (just to make sure you do not have traces of any previous install).
Install latest version of nodejs from their website (I installed v6.9.1 for 64 bit processor).
Go to Environment variables for system (just type environmental variables in start menu if using Windows 10) and edit the Path. Delete ‘C:/Program Files (x86)/nodejs’ (as I had installed 64 bit nodejs). This ensures when using command you do not use any other previously installed nodejs.
Start command prompt in Admin mode and navigate to your project and run npm install.
In case you get any/some error, then run npm info graceful-fs -v or npm info graceful-fs whichever runs in your machine.
Then run npm update -g npm.
Then run npm install again and this time it should work.
Run npm start and everything should work fine.
On running website, sometimes we see any other issue and that can be seen from console logs. But good thing is, console logs also tell you the problem. In most cases its related to 32 bit and 64 bit processor due to our recent changes. In my case, I was facing issue with SASS configuration due to 32/64 bit machine and console log asked me to run npm rebuild node-sass to fix the issue.
Go back to command prompt, hit Ctrl+C to stop npm server. Run node rebuild node-sass. Run npm start again and everything should be working.
Hope it helps.

Cannot find module 'assetmanager'

I'm trying to run the MEAN stack on windows. I've installed all the pre-requisites (I think) but when I try to start the server via the gulp command I get the error:
Error: Cannot find module 'assetmanager'.
IMAGE:
I have tried running npm install assetmanager which run fine but I still get this error.
This is my first time trying to run node on a machine (I should have used a linux box) so go easy on me as I am learning :-).
Any and all help appreciated.
David
I had exactly the same problem on Linux Mint 17.2.
The failing way: This was my first project that I'd generated and I don't think I had all the dependencies installed before I ran the init command (g++ was missing).
I tried the npm install assetmanager command as you did and then install worked. Running gulp after this, it got further but this time I was missing mongoose. I installed that then it couldn't find .../config/env/all so I sylinked the default.js config. Then running gulp again, errorhandler was missing. I figured it shouldn't be this hard so...
The working way: I deleted that failure of a project and init'd a new one and it worked. Unfortunately I'm not sure if the init didn't work the first time but I missed the error/warning or something else caused it. All I can recommend is try creating another project and see if that works.

Almost finishing app and it started crashing

My app was working perfectly until I installed the accounts-facebook and service-configuration package. Now it's giving this error and I have absolutely no idea how to fix it:
/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
throw(ex);
^
Error: Can't find npm module 'mongodb'. Did you forget to call 'Npm.depends' in package.js within the 'cfs_gridfs' package?
at Object.Npm.require (/Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:155:17)
at Package (packages/cfs:gridfs/gridfs.server.js:2:1)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:189:4
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/packages/cfs_gridfs.js:196:3
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:222:10
at Array.forEach (native)
at Function._.each._.forEach (/Users/###/.meteor/packages/meteor-tool/.1.1.3.1eul34x++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /Users/###/proyectos/leads/.meteor/local/build/programs/server/boot.js:117:5
Exited with code: 8
Your application is crashing. Waiting for file change.
What worked for me was simply hitting "Control + C" to stop my app and then running "meteor run" again.
Do you have the cfs_gridfs package?
Your console reference that package in the error
If you're using mrt it means that you're using an old version of Meteor. Once in a while I had similar issues and I would simply edit the file .meteor/packages and the problem was solved when I run meteor command. I'm not sure if the same applies here.

node.js:201 process.nextTick error?

So I'm messing around with meteor, and out of no where I received this error? What is it asking me to change?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected end of input
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:109:21
at Array.forEach (native)
at Function.<anonymous>(/Users/devinandrews/my_cool_app/.meteor/local/build/server/underscore.js:76:11)
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:95:7
Exited with code: 1
Your application is crashing. Waiting for file change.
Thanks guys..
You need to look through the code and see what it's doing in server.js around 109. It is probably working with a network connection that is being abruptly terminated. Are you doing anything like accessing your site with curl and CTRL-C-ing it while it's connected to your server? Because of the disconnected nature of vanilla node.js stack traces, we need to see the code to help you debug this.
This error comes up when you have a syntax error. Perhaps you are missing a closing brace in server.js?
Check that you don't have duplicate and possibly conflicting versions of modules in your global and local paths.
npm list
and
npm list -g
should not list duplicate and/or conflicting versions of modules.
In my case I had ws installed locally and some of its dependencies were also on the global path.
My solution was to remove everything from my local path and just install everything globally.
I've came across this error when I tried to start my server running on ubuntu on a well-known port (0-1023)
If that's the case, just run it as superuser (sudo)
In case that's not possible for you, check out this alternative (https://serverfault.com/a/112798)
in my experience was getting that error, caused by NPM and Node are not match version.
Need make sure NPM and Node are match (not mean same version)

Unable to run bonescript files in Cloud9 on BeagleBone

I am having trouble using the Cloud9 IDE to run files which use bonescript on a BeagleBone with the pre-installed version of Angstrom Linux. I am using Cloud9 at http://beaglebone.local:3000 in Chrome 18 on OSX 10.7.
When I run the Bonescript blinkled.js sample code Cloud9 outputs this error:
Output
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/var/lib/cloud9'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at Array.<anonymous> (module.js:430:10)
at EventEmitter._tickCallback (node.js:126:26)
If I try adding a file path in the run configuration as suggested in this StackOverflow question I get this error in the Console (in bright red mind you):
[C9 Server Exception 2] undefined
At this point Cloud9 also stops responding and I have to reload the page to attempt to use it further.
If I add "blinkled.js" as the file path I get this error:
'inotify' not loaded
If desired, try installing it with:
curl http://npmjs.org/install.sh | bash
npm install inotify
'fibers' not loaded
If desired, try installing it with:
curl http://npmjs.org/install.sh | bash
npm install fibers
Delay operations loops will consume CPU cycles
Invoke using 'node-fibers' if node version < 0.5.2
No idea what I should put in there.
I've been Googling these various errors for about 24 hours now.
This seems like a great tool, if I can only get it to work. Any ideas?
UPDATE 1
After realizing the opkg had failed to load the required inotify and fibers packages I installed them manually and tried again. Now I get this error on the command line:
# node blinkled.js
gpio: 38 already exported.
{ [Error: EBUSY, resource busy or locked] errno: 10, code: 'EBUSY', syscall: 'write' }
Unable to export gpio: 56
Now I realize there were multiple problems:
First, I should have checked the documentation to get node.js to work. I just assumed alert() was a function when I should have been using console.log(). So once I realized this I was able to run this file in Cloud9:
var hello = "hello world"
console.log(hello);
Second, When I tried to install the libraries (inotify and fibers) using the npm package manager it placed them in the node_modules directory in my working directory:
/home/root/
... not the default Cloud9 root directory as I assumed it would:
/var/lib/cloud9
Third, my pins were already exported, which was fixed by simply restarting the BeagleBone.
Finally, I found that creating a new instance in my home directory with the latest version of bonescript allowed me to run the blinkled.js sample file, as well as this file which tests all analog pins on the BeagleBone from the command line.
You might do a 'git pull' in /var/lib/cloud9 to get an update. One thing I've added is an 'analogRead' function.
i bough beagle bone rev. A4. this kind of error is comming on that also.
i have just make new SD card with latest angstrom image, and then after blinky is working properly.

Resources