Error running json-server from React Native app folder - json-server

I'm in the folder of an app created with create-react-native-app. I installed json-server with sudo npm i -g json-server. I've got a db.json in my app folder. When I try to run the server I get this error:
// ♥ json-server db.json
\{^_^}/ hi!
Loading db.json
Done
Resources
http://localhost:3000/photos
Home
http://localhost:3000
Type s + enter at any time to create a snapshot of the database
Some error occurred { Error: getaddrinfo ENOTFOUND localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:58:26)
errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'localhost' }
This occurs whether I'm running the expo server or not. What's wrong?

The localhost might be hidden in host entry location.
Kindly check it and remove.
Eg:
Go to terminal
cd /etc/hosts
#127.0.0.1
remove the hash from localhost and run the json-server.

Related

Can't connect to mongoDB: Mongo error { Error: querySrv ENODATA

My set-up consists of Node.js on Express on the back-end connected to mongoDB through mongoose. When I start the server, I get this error:
Mongo error { Error: querySrv ENODATA `database_hostname`
at errnoException (dns.js:55:10)
at QueryReqWrap.onresolve [as oncomplete] (dns.js:243:19)
code: 'ENODATA',
errno: 'ENODATA',
syscall: 'querySrv',
hostname: `database_hostname` }
This results in me not being able to run my application on localhost due to it being constantly loaded.
At the same time connecting using MongoDB Compass works fine.
The database used to be working fine, but after I changed the location where I have been using it and created manually a new collection in Compass, which did not have a set-up locally, I started getting this error.
Cluster configuration:
SRV Record: off
Read Preference: Primary
SSL: System CA / Atlas Deployment
SSH Tunnel: None

webdriver-manager update command throwing error

Using the command webdriver-manager update throws the
events.js:160 throw er; // Unhandled 'error' event ^
Error: connect ETIMEDOUT 216.58.196.112:443
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14 )
and one thing to note is ,while running this command, dynamically the ip gets changed each and every time
That looks like connection issue, try to ping ip 216.58.196.112:443 and see if it is accessible

parse server migration cannot connect to mongo

This is related to migration to parse server from api.parse.com.
On windows server, installed mongo db and nodeJS.
Installed Python.
Installed Parse Server.
Getting following error messages.
StyleChat is the name of the app.
http://localhost:1337/stylechat
parse-server-example running on port 1337. info: Parse LiveQuery
Server starts running warn: Unable to ensure uniqueness for usernames:
Error: read ECONNRESET
at exports._errnoException (util.js:1036:11)
at TCP.onread (net.js:564:26) warn: Unable to ensure uniqueness for user email addresses: Error: read ECONNRESET
at exports._errnoException (util.js:1036:11)
at TCP.onread (net.js:564:26) (node:252160) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 4): MongoError: read ECONNRESET (node:252160)
UnhandledPromiseRej
if you run nodejs on window, you should use iisnode to run nodejs on iis.
i found this here
have fun.

MongoDB: \lib\server.js:235 process.nextTick getaddrinfo ENOTFOUND error

I'm a begginer in NodeJS and when i run node MainApp.js in console I get this error:
C:\Assigment 2 (NodeJS)\node_modules\mongodb\lib\server.js:235
process.nextTick(function() { throw err; })
^
Error: getaddrinfo ENOTFOUND . .:27017
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
I don't know what this means. Inside MainApp I connect mongoose: mongoose.connect("./DataBase"); where DataBase is the folder where I run mongod --dbpath "C:\[...]\DataBase. The database server seems to start successfully, the console printing: [...] waiting for connections on port 27017.
server.js lines 231-236:
// Try to callback
try {
callback(err);
} catch(err) {
process.nextTick(function() { throw err; })
}
Package versions:
"express": "~4.13.1",
"mongodb": "~2.1.0",
"mongoose": "~4.3.1"
make sure that your database is up and running.
Go to your terminal and in your app directory run:
mongod
Then restart your node server and you should be good go
I do not understand the whole process yet, but I hope this answer will provide some insight:
It seems that running node or npm start without starting up the database returns this error.
If database is started, then changing
mongoose.connect("./DataBase"); (which previously caused the error)
to mongoose.connect('mongodb://localhost/database');fixes the issue.
Intuitively this seems to simply be the error MongoDB returns when it can't find the database used by the server, however this might not be the precise description of the issue.
If someone can provide further insight into the problem, such help would be appreciated.
I changed connection string from mongodb://localhost:27017/ to mongodb://127.0.0.1:27017/ and it worked.

Error connecting meteor to external mongodb

I have a meteor web app that connects to a mongohq database. It's working correctly on heroku, but I can't get it to work on my localhost. It was working on localhost yesterday, but not today.
To be certain, I just ran a git clone in a new folder. Even this clone is throwing errors on localhost. Here's my terminal (FYI, I'm on a windows 8.1 machine that is running an Ubuntu virtual box; also, I've removed the username / password from the log, below):
adam#adam-VirtualBox:~/resSingleTestV2/faze1tables$ export MONGO_URL=mongodb://<username>:<password>#oceanic.mongohq.com:10033/test_db
adam#adam-VirtualBox:~/resSingleTestV2/faze1tables$ meteor
[[[[[ ~/resSingleTestV2/faze1tables ]]]]]
=> Started proxy.
=> Started your app.
=> App running at: http://localhost:3000/
I20140511-12:53:43.438(-4)? Exception in callback of async function: Error: failed to connect to [oceanic.mongohq.com:10033]
I20140511-12:53:43.637(-4)? at null.<anonymous> (/home/adam/.meteor/packages/mongo-livedata/0120179b5c/npm/node_modules/mongodb/lib/mongodb/connection/server.js:536:74)
I20140511-12:53:43.640(-4)? at EventEmitter.emit (events.js:106:17)
I20140511-12:53:43.641(-4)? at null.<anonymous> (/home/adam/.meteor/packages/mongo-livedata/0120179b5c/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
I20140511-12:53:43.641(-4)? at EventEmitter.emit (events.js:98:17)
I20140511-12:53:43.643(-4)? at Socket.<anonymous> (/home/adam/.meteor/packages/mongo-livedata/0120179b5c/npm/node_modules/mongodb/lib/mongodb/connection/connection.js:516:10)
I20140511-12:53:43.643(-4)? at Socket.EventEmitter.emit (events.js:95:17)
I20140511-12:53:43.644(-4)? at net.js:440:14
I20140511-12:53:43.644(-4)? at process._tickCallback (node.js:415:13)
Any help appreciated. Thanks.
I'm connecting via my school's wifi. Turns out they must've done something to prevent me from connecting to mongoHQ because I'm able to connect via other networks.
Strange that it worked for a day or two and then stopped.