node:events:505 throw er; // Unhandled 'error' event while running graph-cli - npm

I have been trying to run the graph npm package. However, whenever I run the command I get the following error. I use WSL2 if that is relevant.
`
node:events:505
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at exports.ConnectionPool. (/usr/local/lib/node_modules/graph-cli/node_modules/mongodb/lib/mongodb/connection/server.js:556:25)
at exports.ConnectionPool.emit (node:events:527:28)
at exports.ConnectionPool.emit (node:domain:475:12)
at exports.Connection. (/usr/local/lib/node_modules/graph-cli/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
at exports.Connection.emit (node:events:527:28)
at exports.Connection.emit (node:domain:475:12)
at Socket. (/usr/local/lib/node_modules/graph-cli/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
at Socket.emit (node:events:527:28)
at Socket.emit (node:domain:475:12)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on NativeConnection instance at:
at NativeConnection.Connection.error (/usr/local/lib/node_modules/graph-cli/node_modules/mongoose/lib/connection.js:389:8)
at /usr/local/lib/node_modules/graph-cli/node_modules/mongoose/lib/connection.js:416:14
at /usr/local/lib/node_modules/graph-cli/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js:57:21
at /usr/local/lib/node_modules/graph-cli/node_modules/mongodb/lib/mongodb/db.js:286:18
at /usr/local/lib/node_modules/graph-cli/node_modules/mongodb/lib/mongodb/db.js:365:7
at processTicksAndRejections (node:internal/process/task_queues:78:11)
`
It's not clear to me why this is happening and I have been struggling to debug this for the last 2 days. Please help!
I have tried running mongodb which then starts up a server on that port, but then the graph command just stay stuck
I have tried upgrading the mongoose version
I have tried reinstalling graph-cli

Related

Unhandled rejection SequelizeConnectionError: Unknown database

This was my full error, I installed all the coorect dependencies but I couldnt figure out why I was still getting this same Error over and over again.
➜ Unsolved git:(main) ✗ node server.js
Unhandled rejection SequelizeConnectionError: Unknown database 'sequelize_library'
at /Users/usersname/Desktop/projects/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/userName/Desktop/projects//node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/Users/userName/Desktop/projects//node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/userName/Desktop/projects/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)
Getting this erros with all the right depencies installed. What worked for me was
(All commands go in terminal)
going into my sql with /usr/local/mysql/bin/mysql -uroot -p
Entering my password then ran source schema.sql which held my create database code
I quit SQL
& ran node server.js

CypressError: `cy.visit()` failed trying to load: https://dev-eccc.env.xxxx.com/ via Gitlab CI job

I have setup a Gitlab ci/cd job to execute all cypress integration tests. I found that all tests are getting fail due to home URL is getting failed to load by cy.visit().
On my local machine it is working fine.
below is the complete Error trace:
CypressError: `cy.visit()` failed trying to load:
https://dev-eccc.env.ihsmarkit.com/
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: getaddrinfo ENOTFOUND dev-eccc.env.ihsmarkit.com
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computer
Because this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `Facility Register`
at http://localhost:45271/__cypress/runner/cypress_runner.js:156433:23
at visitFailedByErr (http://localhost:45271/__cypress/runner/cypress_runner.js:155794:12)
at http://localhost:45271/__cypress/runner/cypress_runner.js:156432:11
at tryCatcher (http://localhost:45271/__cypress/runner/cypress_runner.js:10130:23)
at Promise._settlePromiseFromHandler (http://localhost:45271/__cypress/runner/cypress_runner.js:8065:31)
at Promise._settlePromise (http://localhost:45271/__cypress/runner/cypress_runner.js:8122:18)
at Promise._settlePromise0 (http://localhost:45271/__cypress/runner/cypress_runner.js:8167:10)
at Promise._settlePromises (http://localhost:45271/__cypress/runner/cypress_runner.js:8243:18)
at _drainQueueStep (http://localhost:45271/__cypress/runner/cypress_runner.js:4837:12)
at _drainQueue (http://localhost:45271/__cypress/runner/cypress_runner.js:4830:9)
at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues
(http://localhost:45271/__cypress/runner/cypress_runner.js:4846:5)
at Async.drainQueues (http://localhost:45271/__cypress/runner/cypress_runner.js:4716:14)
From Your Spec Code:
at Object.homepage_test (http://localhost:45271/__cypress/tests?p=cypress/integration/eccc-
app-ui-cypress/API/register_api.ts:71:8)
at Context.eval (http://localhost:45271/__cypress/tests?p=cypress/integration/eccc-app-ui-
cypress/API/register_api.ts:13:25)
From Node.js Internals:
Error: getaddrinfo ENOTFOUND dev-eccc.env.ihsmarkit.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)

reavt native event.js 167 error //unknown error

BUILD SUCCESSFUL in 14s
28 actionable tasks: 1 executed, 27 up-to-date
Running adb -s 988ad833354d59594330 reverse tcp:8081 tcp:8081
Starting the app on 988ad833354d59594330 (adb -s 988ad833354d59594330 shell am start -n com.celebrations/com.celebrations.MainActivity)...
Starting: Intent { cmp=com.celebrations/.MainActivity }
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
i was building the code for the first time and getting this error while compiling.
any solutions for this error??
It means you already use port 8081, but you can run these commands:
sudo lsof -i :8081
kill -9 < PID >

Node.js/ webpack/ getaddrinfo looking for internet when not needed, why?

I've got an issue with a machine that's supposed to be able to run offline.
I can pull the cable after my application is running, but during unplugged start I get the following error:
May 6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
May 6 23:04:50 myco serve[4121]: at Object._errnoException (util.js:1022:11)
May 6 23:04:50 myco serve[4121]: at errnoException (dns.js:55:15)
May 6 23:04:50 myco serve[4121]: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
May 6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
May 6 23:04:50 myco serve[4121]: (node:4121) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
It appears that dns.js is part of webpack/node-libs-browser but thats as far as I can seem to figure out.... I can't find GetAddrInfoReqWrap anywhere in my source tree, or getaddrinfo for that matter. Searching around there's a lot of info with people getting similar errors when deliberately trying to use npm, but thats not what I'm doing. I should have everything I need already on the machine.
Apparently this is a problem with serve.
Serve >6.5.3 apparently has an issue where it tries to contact the registry. Downgrade of serve to 6.5.3 solves this particular issue.
this is documented in https://github.com/zeit/serve/issues/348
not sure why serve would need to contact the registry.
noafterglow is right, but just for reference, rolling back to version 6.5.3 of serve can be accomplished with
npm install -g serve#6.5.3
Source: this post
I ran into exactly this error when trying to serve a VueJs app from a different VM from where the code was developed originally.
The file vue.config.js read :
module.exports = {
devServer: {
host: 'tstvm01',
port: 3030,
},
};
When served on the original machine the start up output is :
App running at:
- Local: http://tstvm01:3030/
- Network: http://tstvm01:3030/
Using the same settings on a VM tstvm07 got me a very similar error to the one the OP describes:
INFO Starting development server...
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo EAI_AGAIN
at Object._errnoException (util.js:1022:11)
at errnoException (dns.js:55:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
If it ain't already obvious, changing vue.config.js to read ...
module.exports = {
devServer: {
host: 'tstvm07',
port: 3030,
},
};
... solved the problem.

Mongoose error when running node

When I run node server.js in terminal, I receive the following error from mongoose:
/Users/XXXX/Desktop/Projects/crud/node_modules/mongoose/node_modules/mongodb/lib/server.js:235
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED 127.0.0.1:27017
at Object.exports._errnoException (util.js:860:11)
at exports._exceptionWithHostPort (util.js:883:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
I've ran npm install mongoose with a warning, but I doubt that's the reason the mongodb database isn't running. Here is the warning:
> kerberos#0.0.17 install /Users/Sean/Desktop/Projects/crud/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99
[-Wimplicit-function-declaration]
maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
^
1 warning generated.
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
It can happen when the mongodb service is not running on your machine.So start with below command it will be help you to open node server with no interrupt as well as mongodb will also run on default port.
brew services start mongodb