I'm trying to do a little debugging with node.js, but the stack trace is leading me into a weird file called events.js. (no path is provided)
What is that file? Where can I find it?
Trace: Test
at Socket.socket.on (C:\test\SocketTest\server.js:11:13)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Socket.onevent (C:\test\SocketTest\node_modules\socket.io\lib\socket.js:335:8)
at Socket.onpacket (C:\test\SocketTest\node_modules\socket.io\lib\socket.js:295:12)
at Client.ondecoded (C:\test\SocketTest\node_modules\socket.io\lib\client.js:193:14)
at Decoder.Emitter.emit (C:\test\SocketTest\node_modules\component-emitter\index.js:134:20)
at Decoder.add (C:\test\SocketTest\node_modules\socket.io-parser\index.js:247:12)
at Client.ondata (C:\test\SocketTest\node_modules\socket.io\lib\client.js:175:18)
at emitOne (events.js:96:13)
Quote from the nodejs documentation:
Node.js has several modules compiled into the binary. These modules are described in greater detail elsewhere in this documentation.
The core modules are defined within Node.js's source and are located in the lib/ folder.
Emphasis mine. So if you don't build nodejs from source code, you won't have it on your file system (hence the missing path).
Anyway, you will encounter it in most traces, but its extremely unlikely that it has anything to do with your actual problem.
Related
I am developing a program to send messages by whatsapp through whatsapp-web.js module, I want to make my program an executable, for this I am using "pkg", however when I generate the executable, I get the following message.
Warning Cannot include directory %1 into executable.
The directory must be distributed with executable as %2.
%1: ..\node_modules\puppeteer\.local-chromium
%2: path-to-executable/puppeteer
I already copied the path where it is requested, here you can see it in vscode
However, when I run the executable I get this:
C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105
throw new Error(missingText);
^
Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (982053).
at ChromeLauncher.launch (C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105:23)
at PuppeteerNode.launch (C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Puppeteer.js:125:31)
at Client.initialize (C:\snapshot\romer\node_modules\whatsapp-web.js\src\Client.js:95:39)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
at Function.runMain (pkg/prelude/bootstrap.js:1941:13)
at node:internal/main/run_main_module:17:47
Does anyone know how to solve this error? I have searched in forums but I have not seen anything that helps me, my code in Github: https://github.com/rromerov/Whatsapp-Web-Project/blob/main/codigo.js
I've installed Cypress according to the cypress docs. After opening Cypress and selecting a test to run, I instantly get the following error:
**Title:** Error running plugin
Message: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js)
Stack trace:
Error: The following error was thrown by a plugin. We stopped running your tests because a plugin crashed. Please check your plugins file (`C:\Users\metin\Desktop\Programming\School\Typescript\From JS to TS\cypress\plugins\index.js`)
at Object.get (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\errors.js:1043:15)
at EventEmitter.handleError (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\index.js:189:20)
at EventEmitter.emit (node:events:394:28)
at ChildProcess.<anonymous> (C:\Users\metin\AppData\Local\Cypress\Cache\9.1.0\Cypress\resources\app\packages\server\lib\plugins\util.js:19:22)
at ChildProcess.emit (node:events:394:28)
at emit (node:internal/child_process:920:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I've been googling for a few hours and I'm looking for help on how to resolve this issue!
Uninstall Nodejs
Download the Nodejs (Recommended For Most Users) version from the link:
https://nodejs.org/en/
Install the downloaded Nodejs
I had the same issues
in my case, this issue was related to my bitbucket.yml.file, I changed: max-time:(set time for running your tests) in my job, and everything works fine
If you're using Cucumber then review your step files in search of misspelling keywords or case sensitive typos like wHEN or thEn
I'm using Azure Function App to handle simple API calls. I'm using JavaScript as the language. I developed locally and tested with func host start and confirmed everything working as needed. Part of the code is parsing a URL. I have the following in my function code:
const url = require('url');
let myUrl = new URL(someInputParameter);
As indicated, this works fine when tested locally, however when deployed in azure, I receive this error message:
018-12-11T10:40:56.236 [Error] Executed 'Functions.myFunction' (Failed, Id=d7d51ed1-d37e-44ec-91d0-070de2005c1c)
Result: Failure
Exception: ReferenceError: URL is not defined
Stack: ReferenceError: URL is not defined
at module.exports (D:\home\site\wwwroot\myFunction\index.js:8:15)
at WorkerChannel.invocationRequest (D:\Program Files (x86)\SiteExtensions\Functions\2.0.12210\32bit\workers\node\worker-bundle.js:28862:26)
at ClientDuplexStream.WorkerChannel.eventStream.on (D:\Program Files (x86)\SiteExtensions\Functions\2.0.12210\32bit\workers\node\worker-bundle.js:28752:30)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at ClientDuplexStream.Readable.push (_stream_readable.js:208:10)
at Object.onReceiveMessage (D:\Program Files (x86)\SiteExtensions\Functions\2.0.12210\32bit\workers\node\worker-bundle.js:42351:19)
at InterceptingListener.module.exports.InterceptingListener.recvMessageWithContext (D:\Program Files (x86)\SiteExtensions\Functions\2.0.12210\32bit\workers\node\worker-bundle.js:41678:19)
Do note that I do require('url'). How do I resolve this?
I figured it out eventually. The code runs in Node 8, therefore require line needs to look like this:
const { URL } = require('url');
Now everything works as expected.
I updated to latest stable version of node (nvm use 16 in my case).
This alone did not work, at least in my case. I could see that my script kept running under node v8.
On mac, use Go To Folder in finder (in my case): /Users/{me}/.nvm/versions/node/v8.12.0
Delete bin.
Ran my script again without any extra require statements and works as expected.
I have a problem with my gulp code.
Every time I try to make a dist file using gulp an error appears.
Something with the GulpUglify tool. (I'm still fairly new to using npm so maybe I did something wrong with the installation. If you think that is the case please explain the exact steps I have to take so that it doesn't go wrong again.
I have tried to find a solution but none of them helped.
I am using es6 in my js code.
Here are some of the links I tried.
(if you need any more info please say so!)
How to minify ES6 functions with gulp-uglify? (this one doesnt have the same error as I do but it might have something to do with es6)
https://github.com/terinjokes/gulp-uglify/issues/249 (I tried to do something with this, but I'm new to gulp and I got my file from a friend so I could have a localhost)
https://github.com/terinjokes/gulp-uglify/issues/281 (etc)
Here is what shows up in the console.
throw er; // Unhandled 'error' event
^
GulpUglifyError: unable to minify JavaScript
at createError (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/lib/create-error.js:6:14)
at wrapper (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/lodash/_createHybrid.js:87:15)
at trycatch (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:26:12)
at DestroyableTransform.minify [as _transform] (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/gulp-uglify/minifier.js:79:19)
at DestroyableTransform.Transform._read (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_transform.js:170:83)
at doWrite (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:406:64)
at writeOrBuffer (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/readable-stream/lib/_stream_writable.js:322:11)
at Readable.ondata (_stream_readable.js:642:20)
at Readable.emit (events.js:159:13)
at addChunk (_stream_readable.js:265:12)
at readableAddChunk (_stream_readable.js:252:11)
at Readable.push (_stream_readable.js:209:10)
at /Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/fork-stream/index.js:51:13
at classifier (/Users/rubennijhuis/Desktop/Projects/under-construction/node_modules/ternary-stream/index.js:20:11)
We run a node app on heroku. The app makes outgoing https connections to many services, but we can't reproduce our problem with any of these services. We are occasionally (6 times in the last 30 minutes) seeing this error appear and having a hard time tracking it down:
Error: CERT_UNTRUSTED
at SecurePair.<anonymous> (tls.js:1381:32)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:980:10)
at CleartextStream.read [as _read] (tls.js:472:13)
at CleartextStream.Readable.read (_stream_readable.js:341:10)
at EncryptedStream.write [as _write] (tls.js:369:25)
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at EncryptedStream.Writable.write (_stream_writable.js:183:11)
at write (_stream_readable.js:602:24)
at flow (_stream_readable.js:611:7)
at Socket.pipeOnReadable (_stream_readable.js:643:5)
at Socket.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at Socket.Readable.push (_stream_readable.js:128:10)
at TCP.onread (net.js:529:21)
at TCP.onread (/app/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31)
The only hint about files is the newrelic module at the bottom, which I assume would be in any stacktrace. Does anyone have advice for figuring out where this error is coming from?
If you are using node 0.10.34, this could be the issue
https://github.com/joyent/node/issues/8894
Recommend using v0.10.33 for now.