How to run johnny-five on Ubuntu 15.04? - javascript

$ node hello.js
1436894483255 Device(s) /dev/ttyUSB0
1436894483279 Connected /dev/ttyUSB0
1436894493287 Device or Firmware Error A timeout occurred while connecting to the Board.
Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting
events.js:87
throw Error('Uncaught, unspecified "error" event.');
^
Error: Uncaught, unspecified "error" event.
at Error (native)
at Board.emit (events.js:87:13)
at Board.log (/usr/lib/node_modules/johnny-five/lib/board.js:623:8)
at Board.(anonymous function) [as error] (/usr/lib/node_modules/johnny-five/lib/board.js:634:14)
at Board.<anonymous> (/usr/lib/node_modules/johnny-five/lib/board.js:407:12)
at Timer.listOnTimeout (timers.js:119:15)
I have installed node and johnny-five on Ubuntu and connected Arduino Nano. But it's throwing the above error.

before you run your node app, try to open arduino:
$ arduino
go to to file > Examples > Firmata, and choose StandardFirmata
once it opens upload it to your arduino.
when done, you should be able to run your node app without any problems

The arduino IDE might be holding the connection to the board. Try closing it.

Related

meteor fails to start server in events.js with write EOF exception

When I try to start a meteor project I always get this error message (on my machine only, the project is working fine on my colleague's machines):
=> Started proxy.
=> Started MongoDB.
events.js:141
throw er; // Unhandled 'error' event
^
Error: write EOF
at exports._errnoException (util.js:907:11)
at WriteWrap.afterWrite (net.js:785:14)
Sometimes the error already shows up before mongo is stared.
In fact, I cannot start any project anymore ... :-(
It seems that I have a serious problem with my meteor installation.
I tried re-installing meteor, but no effect.
meteor reset --> no effect
Could it be a problem with a downloaded package? Where does meteor store the packages?
I really would appreaiate any hint what I can try to make it work again.
I'm using meteor on windows.

Mongodb events.js:85

I am working on this project since long. I am facing some problem which I am unable to solve after trying really hard. I would really appreciate if you guys can help me. I am trying to connect to mongodb database using node.js but whenever I start server I get following error. And I have no idea how to solve that error.
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
The magic happens on port 8080
Connected correctly to server
events.js:85
throw er; // Unhandled 'error' event
^
Error: failed to connect to [undefined:27017]
at null.<anonymous> (C:\Users\Admin\Desktop\Apps\linked-up 0.0.1\easy-node-authentication-master\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\server.js:556:74)
at emit (events.js:118:17)
at null.<anonymous> (C:\Users\Admin\Desktop\Apps\linked-up 0.0.1\easy-node-authentication-master\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:156:15)
at emit (events.js:110:17)
at Socket.<anonymous> (C:\Users\Admin\Desktop\Apps\linked-up 0.0.1\easy-node-authentication-master\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\connection.js:534:10)
at Socket.emit (events.js:107:17)
at net.js:950:16
at process._tickCallback (node.js:355:11)
Thank you for your time and consideration
Are you sure you are up and running mongodb locally in the system ?
To map local path to mongodb try the following command
[location of mongodb]/bin/ mongod --dbpath "specify location of database"
Do you write you code like below?
mongoose.connect(configDB.url); // connect to database
I guess you did't set your configDB.url .
set it with your db url like 'localhost:27017/myDatabase'

Repeated errors will cause Forever to stop restarting node.js app

I am running a node.js server as a backend for a client side Javascript application and we are using Forever to launch the node.js app.
A bug has been discovered in the client code that provides an incorrect path when trying to open a file (because of case insensitivity in our current server). The error is not properly handled and this causes node.js crash. The first few times this occurs Forever sucessfully relaunched the app but after repeatedly triggering the error Forever will fail to bring the app back up and we get a 502 bad gateway error when trying to goto any of the server pages.
Here is the unhandled error:
Error: ENOENT, no such file or directory 'public/projects/testHoc7/hocProject121/agents/agent1/index.agent'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.writeFileSync (fs.js:971:15)
at Object.editAgentXML [as edit_agent_XML] (/srv/AgentCubesOnline/project.js:699:5)
at /srv/AgentCubesOnline/project.js:313:30
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/collection/query.js:159:5
at Cursor.nextObject (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/cursor.js:742:5)
at commandHandler (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/cursor.js:716:14)
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/db.js:1847:9
at Server.Base._callHandler (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/connection/server.js:478:18
error: Forever detected script exited with code: 8
error: Script restart attempt #8
/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/connection/base.js:245
throw message;
and here is the log message we get when Forever fails to restart the app:
Error: ENOENT, no such file or directory 'public/projects/testHoc7/hocProject121/agents/agent1/index.agent'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.writeFileSync (fs.js:971:15)
at Object.editAgentXML [as edit_agent_XML] (/srv/AgentCubesOnline/project.js:699:5)
at /srv/AgentCubesOnline/project.js:313:30
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/collection/query.js:159:5
at Cursor.nextObject (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/cursor.js:742:5)
at commandHandler (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/cursor.js:716:14)
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/db.js:1847:9
at Server.Base._callHandler (/srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)
at /srv/AgentCubesOnline/node_modules/mongodb/lib/mongodb/connection/server.js:478:18
error: Forever detected script exited with code: 8
/usr/lib/node_modules/forever/node_modules/forever-monitor/node_modules/broadway/node_modules/eventemitter2/lib/eventemitter2.js:283
throw arguments[1]; // Unhandled 'error' event
^
Error: Cannot stop process that is not running.
at /usr/lib/node_modules/forever/node_modules/forever-monitor/lib/forever-monitor/monitor.js:332:26
at process._tickCallback (node.js:419:13)
We will of course fix the bug and add proper error handling but I am currently more interested in finding out how to prevent Forever from failing. What could cause Forever to stop bringing node.js back?

socket.io errors when client connects

I have socket.io running successfully on my node.js installation.
info - socket.io started
The console shows it running ok, but as soon as the client (browser) connects:
socket = io.connect('<my host>:8000');
The console is kicking out an error:
crypto.js:123
return new Hash(hash);
^
TypeError: undefined is not a function
at Object.createHash (crypto.js:123:10)
at WebSocket.onSocketConnect (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:120:23)
at WebSocket.handleRequest (/node_modules/socket.io/lib/transport.js:71:10)
at WebSocket.Transport (/node_modules/socket.io/lib/transport.js:31:8)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket/hybi-16.js:59:13)
at new WebSocket (/node_modules/socket.io/lib/transports/websocket.js:31:17)
at Manager.handleClient (/node_modules/socket.io/lib/manager.js:661:19)
at Manager.handleUpgrade (/node_modules/socket.io/lib/manager.js:618:8)
at Server.<anonymous> (/node_modules/socket.io/lib/manager.js:123:10)
at Server.emit (events.js:88:20)
can anyone understand what this might mean?
My code has been working fine on my local machine, its only when moving it to my production server does this error happen.
It turns out it's because Node was installed with the option --without-ssl. This means it doesnt install any of the crypto stuff, which was needed by socket.it. I installed openssl, reinstalled Node, and this fixed it :)

Bogart in NodeJS 0.6.10 on Windows Fails to start with message about 'sys' module

I've been learning how to use Bogart (v 0.3.38) under NodeJS (Windows, v 0.6.10), but I can't even get the basic "hello world!" to work, even though I think it must be a problem with the runtime and Bogart.
I'm using the example listed here just try to make it run. At the beginning, I got this message:
The "sys" module is now called "util". It should have a similar interface.
Then I went through all the files in the folder I'm creating the app and change "sys" to "util" in the require statement, and that, for while, got ride of the message above, but then I started getting a message that said that bogart could not access the isRouter property of undefined, that's when I decided to use the "Hello World" example to see if I was doing something wrong.
Now I get the "sys to util" message mentioned above, a message about the server starting on port 8080 and then a stacktrace:
The "sys" module is now called "util". It should have a similar interface.
Server running on port 8080
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: listen EACCES
at errnoException (net.js:646:11)
at Array.0 (net.js:732:28)
at EventEmitter._tickCallback (node.js:192:40)
Any clues of what might be wrong here?
As always, thanks in advance!
Found the problem: I had another application running on the same default port (8080) of Bogart, changed the port and everything worked.
In my case it was an error of mysql2 connection after update of MySQL config.

Categories

Resources