MMO server crash node.js and mongodb - node.js

so ive been following this tutorial series the guy whos series it is has been no help but when i run i receive this error, has anyone had this error before or knows how to fix it please help me
"C:\Program Files (x86)\JetBrains\WebStorm 10.0.4\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" server.js --env=test
test
Loading Initializer: 00_packetmodels.js
Loading Initializer: 01_mongodb.js
js-bson: Failed to load c++ bson extension, using pure JS version
Loading Model: user.js
Loading Map: prison_1.js
Initialize Completed, Server runnng on port: 8082 for environment: test
c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\base.js:246
throw message;
^
TypeError: Cannot read property 'length' of undefined
at processResults (c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.js:1581:31)
at c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.js:1619:20
at c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.js:1157:7
at c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.js:1890:9
at Server.Base._callHandler (c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\base.js:448:41)
at c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\server.js:481:18
at MongoReply.parseBody (c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\responses\mongo_reply.js:68:5)
at null.<anonymous> (c:\Users\poeketis\WebstormProjects\Prison rp\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\server.js:439:20)
at emitOne (events.js:77:13)
at emit (events.js:169:7)
Process finished with exit code 1
and here is a picture of the mongo log
http://i.imgur.com/ZXcBojJ.png

this is a very common issue (https://www.google.com.ua/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=js-bson%3a%20failed%20to%20load%20c%2b%2b%20bson%20extension%2c%20using%20pure%20js%20version).
Such issues often occur if bson was compiled against a Node version different from the one you run your application with.

Related

how to push data into mongodb using sparkfun phant?

I am new to phant and i cannot find a suitable documentation on phant using mongodb. because i have lots of data and it memory overflow occurs. and finally i fell into following error:
HTTP output: { [Error: EMFILE, open 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv']
errno: -24,
code: 'EMFILE',
path: 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv' }
events.js:87
throw Error('Uncaught, unspecified "error" event.');
^
Error: Uncaught, unspecified "error" event.
at Error (native)
at Function.emit (events.js:87:13)
at Function.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-manager-http/index.js:237:12)
at PhantMeta.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/lib/phant-meta-nedb.js:243:14)
at callback (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/executor.js:30:17)
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/datastore.js:536:25
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/persistence.js:201:12
at fs.js:1077:21
at FSReqWrap.oncomplete (fs.js:95:15)
except this sometimes following error also occurs:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
thats why i want to use mongodb to prevent this error. i searched about this and finally found sparckfun library for mongodb:
https://github.com/sparkfun/phant-stream-mongodb
i installed this but nothing happened as data still not string into mongo.
so, How will i store phant data into mongodb ?
I had the same problem, specifically trying to deploy my own Phant instance on Heroku (since I wanted to circumvent Sparkfun's 50Mb limit). After some dabbling with versions of the mongodb and mongoose libraries, I successfully forked and modified their repository so that you can either run it locally or directly deploy on heroku (just make sure you provision a MongoLab add-on). Check out my fork here: https://github.com/davidlago/phant
Hope this helps!

My meanjs Application is not getting started in offline mode?

I have installed all the prerequisites for a mean application(MEAN) as described in Meanjs Official website
I want you to look at this particular error I am getting and that too when I am offline.
But it does work well when I am connected to internet.
Help me Try looking at the error below:
Could not connect to MongoDB!
Error: failed to connect to [localhost:27017]
C:\Users\ASHOK\Downloads\meanjs-mean-88a89f2\node_modules\connect-mongo\lib\connect-mongo.js:186
throw err;
^
Error: Error connecting to database: failed to connect to [localhost:27017]
at null.<anonymous> (C:\Users\ASHOK\Downloads\meanjs-mean-88a89f2\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\server.js:555
:25)
at emit (events.js:118:17)
at null.<anonymous> (C:\Users\ASHOK\Downloads\meanjs-mean-88a89f2\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\connection_po
ol.js:156:15)
at emit (events.js:110:17)
at Socket.<anonymous> (C:\Users\ASHOK\Downloads\meanjs-mean-88a89f2\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)
[nodemon] app crashed - waiting for file changes before starting...
Did you start mongodb: try typing mongod into the terminal

Mongoose Can't Connect Without Internet

I have my MongoDB server running on localhost:27017, and while I can usually run my Node.js app fine, when I disconnect from the internet Mongoose throws the error
Error: failed to connect to [localhost:27017]
Note that I can still connect to the MongoDB server from the Mongo shell client. Also, if I start up my app first and then lose internet connection, my app can access the database fine offline. So why can't it start up without internet?
EDIT: here is the error in full
events.js:85
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (<My App>\node_modules\mongoose\
node_modules\mongodb\lib\mongodb\connection\server.js:555:74)
at emit (events.js:118:17)
at null.<anonymous> (<My App>\node_modules\mongoose\
node_modules\mongodb\lib\mongodb\connection\connection_pool.js:156:15)
at emit (events.js:110:17)
at Socket.<anonymous> (<My App>\node_modules\mongoos
e\node_modules\mongodb\lib\mongodb\connection\connection.js:534:10)
at Socket.emit (events.js:107:17)
at net.js:923:16
at process._tickCallback (node.js:355:11)
[nodemon] app crashed - waiting for file changes before starting...
Edit: wording
Use 127.0.0.1 instead of localhost. By turning off your wifi interface the OS is no longer able to resolve localhost.
Consider node-offline-localhost.
Add the following before the breaking code:
require('node-offline-localhost').always();
And it just works (hopefully), at least until RFC 3493 gets fixed.
Full disclosure: I authored this package to streamline https in my dev environment when offline.

ERROR [karma]: [TypeError: Cannot call method 'push' of undefined] when adding HTML output

I'm using karma and jasmine for some unit testing. I'd like an html output instead of checking the console / terminal and found this: https://www.npmjs.org/package/karma-htmlfile-reporter which is perfect for my requirements.
When I run it I get an error :
`ERROR [karma]: [TypeError: Cannot call method 'push' of undefined]
TypeError: Cannot call method 'push' of undefined
at onBrowserStart (/usr/local/lib/node_modules/karma/lib/reporters/base.js:14:20)
at null.<anonymous> (/usr/local/lib/node_modules/karma/lib/events.js:15:22)
at EventEmitter.emit (events.js:117:20)
at onStart (/usr/local/lib/node_modules/karma/lib/browser.js:128:13)
at Socket.<anonymous> (/usr/local/lib/node_modules/karma/lib/events.js:15:22)
at Socket.EventEmitter.emit [as $emit] (events.js:117:20)
at SocketNamespace.handlePacket (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/usr/local/lib/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
I've hunted on google for an answer but yet to find one, if I remove the 'html' from the reports in the config it works fine. I've not used jasmine / karma before so unsure where to look for help.
The part of the config related to reports: `
reporters: ['progress', 'html'],
htmlReporter: {
outputFile: 'tests/units.html'
},``
Thanks for any assistance.
I switched to karma 0.10 and everything works.
$ npm uninstall karma
and run following in project root:
$ npm install karma#0.10
Good luck

Node.js redis "unknown command 'hset'"?

I'm new to redis, and I'm trying out various examples. However, it doesn't seem to work:
root#localhost:~# node lol.js
Reply: OK
Error: Error: Error: ERR unknown command 'hset'
Error: Error: Error: ERR unknown command 'hset'
/root/node_modules/redis/index.js:468
throw callback_err;
^
TypeError: Cannot read property 'length' of undefined
at Command.callback (/root/lol.js:15:28)
at RedisClient.return_error (/root/node_modules/redis/index.js:464:25)
at HiredisReplyParser.<anonymous> (/root/node_modules/redis/index.js:253:14)
at HiredisReplyParser.emit (events.js:67:17)
at HiredisReplyParser.execute (/root/node_modules/redis/lib/parser/hiredis.js:41:18)
at RedisClient.on_data (/root/node_modules/redis/index.js:440:27)
at Socket.<anonymous> (/root/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:367:14)
I'm using one of the example scripts on the github page for node-redis. I'm on Debian Squeeze.
The main problem is not with your code (of course it could recognize the error sent by the server) or with the node redis module but with the Redis server.
You need to upgrade it to a newer version, HSET command is supported since version 2.0.0.

Resources