I keep getting this response when trying to run a node app with a MongoDB
body-parser deprecated bodyParser: use individual json/urlencoded middlewares server.js:32:9
body-parser deprecated undefined extended: provide extended option node_modules/body-parser/index.js:105:29
express-session deprecated undefined resave option; provide resave option server.js:35:9
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option server.js:35:9
Running on3000
/Users/tvc/Desktop/SupperClubApp/node_modules/mongoose/node_modules/mongodb/lib/server.js:228
process.nextTick(function() { throw err; })
^`
Error: connect ECONNREFUSED
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
I am unsure as to how to resolve it. Any tips much appreciated.
Analysis:
the issue as per the exception that you copied in the comments says that you Mongodb connection could not be established as there was an issue with Mongodb connection close the previous time. Mongodb will encounter this issue when your computer was forceshutdown due to power outages and other issues.
the exception content from your comments is as below:
[initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty. 2015-10-06T09:50:54.164+0100 D - [initandlisten] User Assertion: 98:Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?
Investigation:
Check if there is a file named Mongod.lock got created in your \bin folder.
Solution:
If the size of the file Mongod.lock is greater than 0KB, please delete the file and re run your mongodb. It should work fine. More details at this link
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
When I am typing npm start in the bash to run my app locally, I get this result:
Listening on http://localhost:7200 Error connecting to mongo {
MongoNetworkError: failed to connect to server [localhost:27017] on
first connect [MongoNetworkError: connect ECONNREFUSED
127.0.0.1:27017]
at Pool. (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\topologies\server.js:431:11)
at Pool.emit (events.js:198:13)
at connect (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\pool.js:557:14)
at makeConnection (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:39:11)
at callback (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:261:5)
at Socket.err (C:\Users\Lope\Desktop\trainingCampus\week6\BERcycle\node_modules\mongodb-core\lib\connection\connect.js:286:7)
at Object.onceWrapper (events.js:286:20)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19) name: 'MongoNetworkError', errorLabels: [
'TransientTransactionError' ], [Symbol(mongoErrorContextSymbol)]: {}
}
How can I solve this?
A TransientTransactionError is a transactional error that is classified as temporary, and if retried it may be successful. Furthermore, a TransientTransactionError write conflict occurs prior to a commit when no write lock has been taken and the transaction (new data) is not reflected in the transaction snapshot (previous data). As a result, these errors are completely safe to retry until there is a successful commit
Please also try to add your current IP to whiteList following "main page > security section > network access > add IP" in MongoDB website
Try out the following code:
sudo rm -rf /tmp/mongodb-27017.sock
sudo service mongod start
ls -lsah /tmp/mongodb-27017.sock
0 srwx------ 1 mongodb mongodb 0 Aug 24 04:01 /tmp/mongodb-27017.sock
First, Check If you are able to connect with mongo locally,
Use this command
mongo
Now there will be two scenario.
1. mongo is not running locally on localhost:27017
2. If mongo is running locally then use below command
mongod
Above command will give you the exact error causing mongo to not start.
Do check this and then share further detail.
Here's what I do and have everything up and running without issues. After downloading mongo from official site, unzip the contents, change the folder name to “mongodb”, and move it to your users home directory. From there, create a “mongodb-data” directory in your user directory to store the database data. You can start the server using the following command. Make sure to swap out “username” with the correct path to your users home directory. /Users/{username}/mongodb/bin/mongod --dbpath=/Users/{username}/mongodb-data
This is for Mac installation btw but should be similar to other OSs
I am fetching videos from the facebook graph api(24*7) using nodejs. My code is working fine but after every 3 or 4 days it stops working and gives the following error: (Ignore the I'm in loop statements)
Error: connect ENETUNREACH 2a03:2990:f015:12:face:b00c:0:2:443 - Local (:::0)
at Object._errnoException (util.js:1003:13)
at _exceptionWithHostPort (util.js.1024:20)
...
Check you internet connection . That solved my problem as ENETUNREACH is a network issue such as host unreachable or your gateway not working .
In my case, I just changed the localhost property to 127.0.0.1 as follows:
var connection = mysql.createConnection({
// host : 'localhost', // localhost causes somehow this error
host: '127.0.0.1',
I had a similar error, I disabled IPv6 on my computer and then the error stopped occurring.
I got the same issue. My problem was I still have the corp proxy settings in npm config. My resolution:
Check if any proxy settings in place
npm config list
Remove them
npm config delete https-proxy
You may have more. But after that, the error's gone.
I'm trying to get meteor reset to work in vagrant box. However I kept getting errors. This is my error message:
/home/vagrant/.meteor/packages/meteor-tool/.1.1.10.8ogiso++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:278
throw(ex);
^ Error: EBUSY, rmdir '/vagrant/foosboom-meteor/.meteor/local'
at Object.Future.wait (/home/vagrant/.meteor/packages/meteor-tool/.1.1.10.8ogiso++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:398:15)
at Object.rm_recursive (/tools/fs/files.js:270:9)
at Command.main.registerCommand.name [as func] (/tools/cli/commands.js:1211:9)
at /tools/cli/main.js:1378:23
I'm using hashicorp Otto as my development environment.
I have performed a mount on the local folder as suggested by one of the user here.
Any idea what seems to be the problem? Thanks.
After mounting you can't reset your mongo so do this
sudo umount -f /vagrant/foosboom-meteor/.meteor/local
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'
The Example of Dojo tests run under Intern (https://github.com/theintern/intern-examples/tree/master/dojo-example) does not actually test anything, fails on connect to the Sauce network:
$ npm test
> dojo-intern-example#0.1.0 test /home/bogdanbiv/WebstormProjects/intern-examples/dojo-example
> intern-runner config=tests/intern
Listening on 0.0.0.0:9001
Starting tunnel...
Using no proxy for connecting to Sauce Labs REST API.
**********************************************************
A newer version of Sauce Connect (build 1283) is available!
Download it here:
https://saucelabs.com/downloads/sc-4.3-linux.tar.gz
**********************************************************
Started scproxy on port 49172.
Starting secure remote tunnel VM...
Secure remote tunnel VM provisioned.
Tunnel ID: 2f904e21cf1e4c3e83f63a4b3089127c
Secure remote tunnel VM is now: booting
Secure remote tunnel VM is now: running
Remote tunnel host is: maki76020.miso.saucelabs.com
Using no proxy for connecting to tunnel VM.
Establishing secure TLS connection to tunnel...
Cleaning up.
Finished! Deleting tunnel.
Error: failed to connect to tunnel VM.
Error: failed to connect to tunnel VM.
at reject <node_modules/intern/node_modules/digdug/SauceLabsTunnel.js:353:17>
at readStartupMessage <node_modules/intern/node_modules/digdug/SauceLabsTunnel.js:381:12>
at <node_modules/intern/node_modules/digdug/SauceLabsTunnel.js:434:12>
at Array.some <native>
at Socket.<anonymous> <node_modules/intern/node_modules/digdug/SauceLabsTunnel.js:428:21>
at Socket.EventEmitter.emit <events.js:117:20>
at Socket.<anonymous> <_stream_readable.js:746:14>
at Socket.EventEmitter.emit <events.js:92:17>
at emitReadable_ <_stream_readable.js:408:10>
at emitReadable <_stream_readable.js:404:5>
npm ERR! weird error 1
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
Ok it does complain about having an old Sauce Connect binary, but even after downloading and inserting the path of the newest SC (4.3). I also updated .bin/intern-runner to contain js as a running environment as opposed to the old node command. User and password are the ones from the repository (left them unchanged). I followed the documentation and did uncomment the tunnel in the intern config file.
UPDATE: This problem still occurs. I find it wierd that a proxy is started Started scproxy on port 54687., but, further down, Using no proxy for connecting to tunnel VM.. Aren't these lines supposed to match?
It could be that this mismatch has nothing to do with the original problem? The new Sauce Connect binary is still ignored.
UPDATE: Actually this solution affects only client, local - intern-client config=tests/intern. As a result this solution solves a different problem than the one originally posted. /UPDATE
The problem was that although I executed bower install as documented, the bower components installed in a folder set by the bowerrc global configuration. This was quite different from what the Dojo TodoMVC example required for its components.
Also submitted an issue at https://github.com/theintern/intern-examples/issues/10 and a pull request.