nodemon runs different version of simply node - nodemon

I will try to summarize my problem here.
I have one nodeJS application, that application need to run in node version >14 our <12.
When I try to run using node command, it works fine, they use node version 14. But when I try to run with nodemon, the app crashes. I start to using node --version alert and see the nodemon use version 13.
plemos#ubuntu:~/Documents/company-BE$ node index.js
redis.port: 6379
redis.host: localhost
Initiating queue ...
process.env.NODE_ENV: local
process.env.GOOGLE_APPLICATION_CREDENTIALS: /home/plemos/Documents/company-BE/googleKey.json
database: localhost:27017
databaseOption: {"poolSize":5,"useNewUrlParser":true,"useFindAndModify":false,"useCreateIndex":true,"useUnifiedTopology":true,"authSource":"admin","dbName":"company"}
(node:28861) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28861) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:28861) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:28861) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
company BackEnd server start DEV on port 6008!
Versions: {"node":"14.16.0","v8":"8.4.371.19-node.18","uv":"1.40.0","zlib":"1.2.11","brotli":"1.0.9","ares":"1.16.1","modules":"83","nghttp2":"1.41.0","napi":"7","llhttp":"2.1.3","openssl":"1.1.1j","cldr":"37.0","icu":"67.1","tz":"2020a","unicode":"13.0"}
mongodb connection string: localhost:27017/company
connected to mongodb
Run nodemon
nodemon
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js
[nodemon] starting `node --version; node index.js`
v13.6.0
/home/plemos/Documents/company-BE/node_modules/uuid/dist/esm-browser/index.js:1
export { default as v1 } from './v1.js';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1060:16)
at Module._compile (internal/modules/cjs/loader.js:1108:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/plemos/Documents/company-BE/src/controllers/bulkImport/doBulkImport.js:26:24)
at Module._compile (internal/modules/cjs/loader.js:1144:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14)
at Module.require (internal/modules/cjs/loader.js:1033:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/plemos/Documents/company-BE/src/routes/bulkImport.js:80:17)
at Module._compile (internal/modules/cjs/loader.js:1144:30)
Any sugestions ?

Related

error when launching postman client in linux

i downloaded the latest postman client for RHEL7.
when trying to launch the client i am seeing the following error.
any pointers greatly appreciated.
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to get 'userData' path
at Object.<anonymous> (/home/xxxxxxx/spec/Postman/app/resources/app/common/controllers/WindowController.js:4:27)
at Module._compile (node:internal/modules/cjs/loader:1110:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1140:10)
at Module.load (node:internal/modules/cjs/loader:982:32)
at Module._load (node:internal/modules/cjs/loader:823:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
at Module.require (node:internal/modules/cjs/loader:1006:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/home/xxxxxxx/spec/Postman/app/resources/app/services/windowManager.js:14:22)
at Module._compile (node:internal/modules/cjs/loader:1110:14)

Cant seem to run aws cdk command?

I just re-installed aws cdk and when i run cdk synth I am getting this error:
/usr/local/lib/node_modules/aws-cdk/lib/index.js:4920
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/aws-cdk/bin/cdk.js:3:15)
I was able to solve this by changing my node version to 16.16.0

Pm2 and nginx not communicating failed (SSL: error:0A000126:SSL routines::unexpected eof while reading)

Hello I am experiecing the error code Failed to load resource: net::ERR_CONNECTION_REFUSED and have found the error code below in nginx error.log. I am using pm2 and nginx. I have tried to restart both pm2 and nginx but it didnt fix anything. Pm2 status is telling me everything is working fine and pm2 logs are saying the server is running. So my best guess is going of the code below. How do I fix it?
2022/05/18 13:19:26 [crit] 19004#19004: *1003 SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading) while keepalive, client: x.x.x.x, server: 0.0.0.0:443
I also get this error code now from pm2 logs:
Error: listen EADDRINUSE: address already in use :::3005
at Server.setupListenHandle [as _listen2] (node:net:1372:16)
at listenInCluster (node:net:1420:12)
at Server.listen (node:net:1508:7)
at Function.listen (/home/ubuntu/apps/bachelor-app/Server/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/ubuntu/apps/bachelor-app/Server/Server.js:239:5)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3005
}
I can however only see one of them running with pm2 status

Kubernetes param store issue

I get an error related to aws paramstore in kubernetes container.
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.00s.
yarn run v1.22.5
$ db-migrate --config ./src/db/config.js --migrations-dir ./src/db/migrations -e config up
[ERROR] Error: getaddrinfo EAI_AGAIN ssm.eu-west-1.amazonaws.com
at ParameterQuery.executeSync (/backend/node_modules/aws-param-store/lib/param_query.js:99:19)
at getParametersSync (/backend/node_modules/aws-param-store/lib/index.js:49:10)
at /backend/config/__helpers/awsParams.js:23:34
at Array.reduce (<anonymous>)
at retrieveAWSParams (/backend/config/__helpers/awsParams.js:22:28)
at getAwsParams (/backend/config/__helpers/awsParams.js:61:22)
at Object.<anonymous> (/backend/config/index.js:21:13)
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)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.

Unable to import module 'index': Error in aws cloud watch logs while using firebase-admin module

I am trying to retrieve data from a firebase database when an alexa intent is triggered. Whereas everything is set up, the lambda function crashes as soon as I am requiring the firebase-admin module.
I am using the recommended way of authentication:
const admin = require('firebase-admin');
const serviceAccount = require("./{{GENERATED_JSON_FROM_FIREBASE}}.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://{{MY_FIREBASE}}.firebaseio.com"
});
Here's the error from CloudWatch:
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/task/node_modules/firebase-admin/node_modules/grpc/src/node/src/grpc_extension.js:30:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
END RequestId: 13504ee8-ac0a-11e7-bef6-2bc764d73bbe
Line 30 in grpc_extension.js says:
var binding = require(binding_path);
Any help for a total newbie?
EDIT:
As other solutions to similiar problems state, that false zipping may cause the error, I want to make clear, that I zip only the contents of my project folder by using the terminal
command zip -r myskill.zip *
Moreover I executed chmod -R 777 on the node_modules/ folder