Error While Running Nodemon Server - express

When i try to run my file with nodemon src/app.js I get this error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Object.exports._errnoException (util.js:1008:11)
at exports._exceptionWithHostPort (util.js:1031:20)
at Server._listen2 (net.js:1253:14)
at listen (net.js:1289:10)
at Server.listen (net.js:1385:5)
at EventEmitter.listen (/Users/kevinmcnamara/express-dill/dill- website/node_modules/express/lib/application.js:617:24)
at Object.<anonymous> (/Users/kevinmcnamara/express-dill/dill-website/src/app.js:21:5)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
[nodemon] app crashed - waiting for file changes before starting...
I have tried running ps -w | grep node then running the kill command with the PID number I get running the previous command, but it returns a message saying - No such process.
Does anyone have any advice to get my express server running again?

Related

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

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

Issues when deploying my serverless project in windows

I have created a serverless boilerplate project using this command
sls create --template aws-nodejs-typescript --path my-project
I configured properly my AWS credantials thus I was able to depoly it successfully without any problem
sls deploy
But when I test de hello function I get the following error (after executing sls logs -f hello)
ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot
find module 'handler'\nRequire stack:\n-
/var/runtime/UserFunction.js\n-
/var/runtime/index.js","stack":["Runtime.ImportModuleError: Error:
Cannot find module 'handler '","Require stack:","-
/var/runtime/UserFunction.js","- /var/runtime/index.js"," at
_loadUserApp (/var/runtime/UserFunction.js:100:13)"," at Object.module.ex ports.load (/var/runtime/UserFunction.js:140:17)","
at Object. (/var/runtime/index.js:43:30)"," at
Module._compile (internal/modules/cjs/loader.js :999:30)"," at
Object.Module._extensions..js
(internal/modules/cjs/loader.js:1027:10)"," at Module.load
(internal/modules/cjs/loader.js:863:32)"," at Func
tion.Module._load (internal/modules/cjs/loader.js:708:14)"," at
Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:60:12)"," at intern
al/main/run_main_module.js:17:47"]} END RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 REPORT RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 Duration: 164.91 ms Billed
Duration: 165 ms Memory Size: 1024 MB Max Memory Used: 15 MB
Unknown application error occurred Runtime.ImportModuleError
I think the problem is in the Windows environment, because when I deploy the service with Mac it works with no issue ! Did I need an extra-configuration to use Serverless with windows ? Thanks for any suggestion

React-native/hermes build error. no such file or directory: index.android.bundle.packager.map

Description
Getting the following messages during build with hermesEnabled set to true
('...' represent removed text):
(full error log is here)
android\app\build\generated\assets\react\release\index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...
android\app\build\generated\assets\react\release\index.android.bundle:27:2907: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...
android\app\build\generated\assets\react\release\index.android.bundle:92:57773: warning: the variable "setTimeout" was not declared in function "wi"
...
fs.js:114
throw err;
^
Error: ENOENT: no such file or directory, open 'android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Object.<anonymous> (C:\esites-grocery\test2.hermes\plumpclient\node_modules\react-native\scripts\compose-source-maps.js:33:43)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
FAILURE: Build failed with an exception.
* Where:
Script 'node_modules\react-native\react.gradle' line: 191
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
(The referenced file exists, at least after the build failed).
Environment
Building on Windows 10
React Native version: 0.62.2
What I tried to do
Tried to bump soLoader to 0.8.0 and to 0.8.2 (although this is not supposed to be needed in RN 0.62.2) as suggested in https://github.com/facebook/react-native/issues/25927#issuecomment-539415154
Modifying the following extra packages definition in build.gradle:
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map"]
to
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/sourcemaps/react/release/index.android.bundle.packager.map"]
Fixed the error (the warnings are still there).
An APK is created and is running..
./gradlew clean
After doing the ./gradlew clean It worked for me.
OR
For Windows:
gralde clean

create-react-app circle build failed

!/bin/bash -eo pipefail
yarn build
yarn run v1.6.0
$ react-scripts build
Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
events.js:183
throw er; // Unhandled 'error' event
^
Error: This socket has been ended by the other party
at Socket.writeAfterFIN [as write] (net.js:364:12)
at PoolWorker.writeJson (/home/circleci/repo/node_modules/thread-loader/dist/WorkerPool.js:89:22)
at PoolWorker.run (/home/circleci/repo/node_modules/thread-loader/dist/WorkerPool.js:69:12)
at WorkerPool.distributeJob (/home/circleci/repo/node_modules/thread-loader/dist/WorkerPool.js:326:20)
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/queue.js:10:5
at Object.process (/home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/queue.js:175:17)
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/queue.js:115:15
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/onlyOnce.js:12:16
at callback (/home/circleci/repo/node_modules/thread-loader/dist/WorkerPool.js:163:21)
at /home/circleci/repo/node_modules/thread-loader/dist/WorkerPool.js:190:15
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/map.js:32:9
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/once.js:12:16
at replenish (/home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/eachOfLimit.js:61:25)
at iterateeCallback (/home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/eachOfLimit.js:50:17)
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/onlyOnce.js:12:16
at /home/circleci/repo/node_modules/thread-loader/node_modules/async/internal/map.js:29:13
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1

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