I'm trying to build a tool that requires the user to load a node bundle JS file during runtime and evaluate some of the exported functions.
Currently on the local Dev environment this works fine using (do note path is a user path)
delete require.cache[path];
let inst = await import(path);
if (!inst.default) {
console.warn(`Unable to load core from ${path}`)
return false;
}
But once packaged I'm getting the following error,
[112207:0221/164632.255945:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
16:46:32.350 › Checking for update
16:46:35.212 › Update for version 4.5.0 is not available (latest version: 4.5.0, downgrade is disallowed).
16:46:35.213 › checkForUpdatesAndNotify called, downloadPromise is null
(node:112169) UnhandledPromiseRejectionWarning: Error: Cannot find module '/home/ukr/Documents/work/<file>.js'
at t (/tmp/.mount_GradieAhn7PR/resources/app.asar/dist/main/main.js:2:536067)
at /tmp/.mount_GradieAhn7PR/resources/app.asar/dist/main/main.js:2:519883
at IpcMainImpl.<anonymous> (/tmp/.mount_GradieAhn7PR/resources/app.asar/dist/main/main.js:2:519841)
(Use `electron-react-boilerplate --trace-warnings ...` to show where the warning was created)
(node:112169) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
^C^C
This is a quick internal devtool and requires no dependency loading nor security. How can I archive this? Thanks in advance!
I am getting below warning message while building my react js project using CI
npm build fails with below message:
npm run build command contains --trace-warnings. But it has not trace exact location of warning.
(node:179) UnhandledPromiseRejectionWarning: Failed to compile server
at emitUnhandledRejectionWarning (internal/process/promises.js:170:15)
at processPromiseRejections (internal/process/promises.js:247:11)
at processTicksAndRejections (internal/process/task_queues.js:96:32) (node:179)
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(). To terminate the node process on unhandled promise
rejection, use the CLI flag --unhandled-rejections=strict (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 1) (node:179) [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.
at emitDeprecationWarning (internal/process/promises.js:180:11)
at processPromiseRejections (internal/process/promises.js:249:13)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
Is there a way I can ignore the warning during this process as I cannot find out the cause of this warning and not able to fix this.
Node version 10.16.3
npm version. 6.9.0
Using Jenkins for CI.
Short version:
I am looking for a way to way to run my NestJS application with the '--trace-warnings' flags that nodeJS offers. Is there some way to do this or does NestJS offer something similar?
Long version:
Hi! NestJS noob here. I am trying to run a dev version of the NestJS application I am working on. However, on starting the application I get the error below.
Clearly, it is missing a catcherror somewhere! However, the dev version has a LOT of updates and this error can be anywhere so I am hoping for a more efficient way of finding this bug than just checking every single new function! In the errormessage there are a few tips on flags to run while starting the application (node --trace-warnings ...). However, these are for node and not NestJS.
So therefore my question; is there some way to run NestJS with the --trace-warnings flag or some other efficient way to find where I am missing the catcherror?
Thanks in advance!
Error:
(node:72899) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:72899) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:72899) [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.
(node:72899) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
(node:72899) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Well, 6379 is the Redis default port, it seems like Nest cannot connect to it :)
By the way, give a look at this paragraph:
https://docs.nestjs.com/exception-filters#catch-everything
In order to catch every unhandled exception (regardless of the
exception type), leave the #Catch() decorator's parameter list empty,
e.g., #Catch().
import {
ExceptionFilter,
Catch,
ArgumentsHost,
HttpException,
HttpStatus,
} from '#nestjs/common';
#Catch()
export class AllExceptionsFilter implements ExceptionFilter {
catch(exception: unknown, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse();
const request = ctx.getRequest();
const status =
exception instanceof HttpException
? exception.getStatus()
: HttpStatus.INTERNAL_SERVER_ERROR;
response.status(status).json({
statusCode: status,
timestamp: new Date().toISOString(),
path: request.url,
});
}
}
To answer your specific question:
I am looking for a way to way to run my NestJS application with the '--trace-warnings' flags that nodeJS offers. Is there some way to do this or does NestJS offer something similar?
I've been trying to do the same thing, and there seems to be next-to-no documentation online on how to do this. Through some trial and error, I've found that this seems to work:
node --trace-warnings -r source-map-support/register --inspect dist/main
Note that this won't rebuild your application (neither when you first start it up, or by watching for changes), so you'll need to do that manually. The debugger is enabled via --inspect switch, remove that if you don't need to debug.
try to use a npm response / request logger like winston or moesif you will get a lot of help trust me.
here are the links for these library for nestjs
https://github.com/scalio/nest-couchdb
I installed aeproject by doing:
$ npm install -g aeproject
Initiallized my project with
$ aeproject init
And when I want to test it with
$ aeproject test
I get the following error:
(node:68448) UnhandledPromiseRejectionWarning:
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js:1
Error: Cannot find module 'aeproject-utils' Require stack:
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js
/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/index.js
/Users/meli/MyStuff/MyAE/ae_tutorial1/test/exampleTest.js
/usr/local/lib/node_modules/aeproject/node_modules/mocha/lib/mocha.js
/usr/local/lib/node_modules/aeproject/node_modules/mocha/index.js
/usr/local/lib/node_modules/aeproject/aeproject-test/aeproject-test.js
/usr/local/lib/node_modules/aeproject/aeproject-test/test.js
/usr/local/lib/node_modules/aeproject/commands.js
/usr/local/lib/node_modules/aeproject/aeproject-cli.js
at Object. (/Users/meli/MyStuff/MyAE/ae_tutorial1/node_modules/aeproject-lib/dist/aeproject-deployer.js:21:43)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) (Use node --trace-warnings ... to show where the warning was created) (node:68448)
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(). To terminate the node process on unhandled promise
rejection, use the CLI flag --unhandled-rejections=strict (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 2) (node:68448) [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.
You can fix this issue by doing
$ npm install aeproject-utils prompts aeproject-logger
I'm trying to run the expo but nothing happens.
My try:
➜ expoTest git:(master) ✗ yarn start
yarn run v1.22.4
$ expo start
Starting project at /Users/seungjune/project/tutorial/expoTest
When I tried npm start or yarn start or expo-cli start, it still not working after the message as follows
Starting project at /Users/seungjune/project/tutorial/expoTest
I found error after starting meesage as follows
(node:3581) UnhandledPromiseRejectionWarning: RangeError [ERR_SOCKET_BAD_PORT] [ERR_SOCKET_BAD_PORT]: options.port should be >= 0 and < 65536. Received 65536.
at validatePort (internal/validators.js:193:11)
at Server.listen (net.js:1440:5)
at /usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:8:12
at new Promise (<anonymous>)
at testPortAsync (/usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:6:10)
at availableAsync (/usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:24:17)
at /usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:37:23
at new Promise (<anonymous>)
at freePortRangeAsync (/usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:33:10)
at /usr/local/lib/node_modules/expo-cli/node_modules/freeport-async/index.js:43:18
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3581) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:3581) [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.