Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Jun 02 06:16
    @ljharb banned @frank-dspeed
  • Apr 27 2018 01:23
    @MylesBorins banned @fjeddy
  • Feb 24 2016 08:26
    @rvagg banned @jonathanenbe
Ali Sabet
@ljharb I see, thanks!
Okay how about this: Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND proxy
Jordan Harband
do you have a proxy on your system?
Ali Sabet
nope, I'm on windows 10 and have proxy settings off
Ali Sabet
I get this error when trying to install electron@6.1.12, but not electron@11.0.0. Does this it mean that release is no longer in the registry?
Jordan Harband
no, the registry is largely immutable. https://unpkg.com/browse/electron@6.1.2/ exists jut fine
Jakub Barczyk
Hi everyone, I've noticed here https://docs.npmjs.com/cli/v7/commands/npx#compatibility-with-older-npx-versions a typo in the --parseable --> should be --parsable right?
Jordan Harband
why would it be that?
the english word is "parseable", not "parsable"
Jakub Barczyk
@ljharb alright then ^__^ brain fart I guess.
I am trying to download a file to react from the server which is in node js. Nodejs send response in createReadStream pipe() and in react I am sending AXIOS request with responseType to blob but after download file I am getting when opening file with Failed to load PDF
//React Code
await axios
      .get(`URL`, {
        responseType: 'blob',
      .then(res => {
        fileDownload(res.data, fileName, fileType);
      .catch(err => {
        const msg = (err && err.response && err.response.statusText) || 'Something went wrong';
        notify.show(`Opps! ${msg}`, 'error', 1500);


        `attachment; filename=${fileBaseName}`,
      res.setHeader('Content-type', 'none');
      const stats = fs.statSync(filePath);
      res.setHeader('Content-Length', stats.size);

      const filestream = fs.createReadStream(filePath);
const filePath = `./11162020115809Test.pdf`;
  if (fs.existsSync(filePath)) {
always returns false even file is present
Jordan Harband
@theromie fs.existsSync(path.join(__dirname, filePath))?
Isheke Peter
Hey guys I'm looking to hire blockchain developers and a software programmer. Please anyone interested can DM me
Guilherme C. Souza
Hello! Anyone there ever worked with HTTPS server's SNICallback? I wanted to know when precisely it's called. I can see it's not in EVERY request. So I'm guessing only the first request for a given domain and after that it repeats the secure context. Does it account any expiry time at all? Thanks for your time.
Mile Mijatović
How to properly show schema validation message in postman ?
const userSchema = new Schema({
  email: {
    type: String,
    unique: true,
    validate: {
      validator: validateEmail,
      message: 'Unesite ispravnu e-mail adresu'
    required: [true, 'Unesite ispravnu e-mail adresu']
  password: {
    type: String,
    required: 'Lozinka je obavezna',
    minlength: [4, 'Lozinka mora da sadrži minimalno 4 karaktera']
but in Postman I get this
ValidationError: User validation failed: email: Unesite ispravnu e-mail adresu etc. etc. etc.
exports.userSignup = (req, res, next) => {
  const user = new User({
    email: req.body.email,
    password: req.body.password

  // Save the user
    .then((result) => {
        message: 'Novi korisnik je dodat',
        result: result
    .catch((err) => {
      if (err.code == 11000) {
            'Korisnik s unesenom e-mail adresom već postoji u bazi. Molimo vas provjerite e-mail adresu i pokušajte ponovo.'
      } else {
        return next(err);
this validation message works fine
Mile Mijatović
But how to do the same from schema
Mile Mijatović
Hmm, I noticed that when I sent post request , validation from mongoose schema has Content-Type : html / text
should be application / json
I have defined res.setHeader('Content-Type', 'application/json'); but does not work in this case
Anyone ?
Ilya Revenko
I've built a CLI for generating optional Node boilerplate
Can you please give some feedback on it?
Available on npm with: npx forge-node-app
Roman Kushyn

@irevenko tested it, great work, respect!
Minor thing: while installing something I see static icon, I'd like to see animated one
Personally I wish to have an option in eslint (or prettier) to remove semicolons, I suppose many other devs also customize eslint for this

How about more detailed project setup, like if it's web project it would suggest to choose between express, nest and other web libraries;
It could suggest database libraries, would be perfect to have brief description for each option, including download stats, github stars, open issues count etc

Again in case of web project it could kind of boilerplate, user can choose "3-layered architecture", or "domain based architecture", and it will generate some basic crud.
Maybe it's too much and it's not what you wanted to achieve

Ilya Revenko
@romeerez I want this CLI to serve general purpose Node app, not web specific.
You can remove semicolons with one rule which is - semi or just use Standard lint cfg
I think it would be better to create another CLI like forge-x-app where x is express or others
Jordan Harband
don’t remove semicolons. They’re required - so much so that the language tried to fix your mistake
but yes, eslint and prettier both support removing semicolons if you’re a glutton for punishment
(semicolons are punctuation; punctuation matters)
Jakub Barczyk
@ljharb well said, Sir!
Roman Kushyn
@ljharb semicolons is matter of taste. I agree that many developers prefer to have them, but I also worked on a big project where eslint was configured to remove them and I was like "oh, I'm not the only one!"
On other hand, if you don't know where they are required, it's better to always have them. As I know, it's only one case: ;(before expression in parentheses), so it's very easy to remember
Jordan Harband
@romeerez see, you’re wrong :-) it’s before (, [, a backtick, and a number of other places
and, the language will be adding more places eventually
Roman Kushyn
@ljharb ya, really, I was wrong, because I use rarely (expressions in "()"), but never used [such] or such as standalone expressions, did you?
For example, sometimes I write (window as any).foo = footo debug something in console, but what use cases may be for [] or ``?
Jordan Harband
i occasionally have an array literal that i promptly forEach or map over
backticks would be a tagged template literal, with a newline after the tag - not something i write, but something ASI can accidentally make happen
the point isn’t whether you’re likely to want these patterns, it’s that it’s more to think about that can break your code.
the rules you have to remember when using semicolons are simpler and fewer.
Hi, all I want to build a video group chat application based on Selective forwarding unit(SFU) architecture using mediasoup , when I googled it I saw the terms webrtc, socket.io, mediasoup. I am beginner in node js. Could anyone tell me diff between webrtc, socket.io, mediasoup?
William Roseberry

Is there a direct (or close enough) equivalent to C#'s Parallel.For() loop in JavaScript?

I'm wanting to do this something like this: Parallel.For(0, someArray.Count, i => resultArray[i] = someMethod(param1[i], param2[i]))


Please help!
After adding passport strategy in my express app, and doing npm start i get following error in my console

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.14.8
3 info using node@v14.14.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle server@1.0.0~prestart: server@1.0.0
6 info lifecycle server@1.0.0~start: server@1.0.0
7 verbose lifecycle server@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle server@1.0.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server/node_modules/.bin:/home/jakegiri/.local/bin:/home/jakegiri/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
9 verbose lifecycle server@1.0.0~start: CWD: /run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server
10 silly lifecycle server@1.0.0~start: Args: [ '-c', 'node index.js' ]
11 silly lifecycle server@1.0.0~start: Returned: code: 1  signal: null
12 info lifecycle server@1.0.0~start: Failed to exec start script
13 verbose stack Error: server@1.0.0 start: `node index.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid server@1.0.0
15 verbose cwd /run/media/jakegiri/Volume 1/codingUdemy/fullStack/NWR_emaily_2/server
16 verbose Linux 5.8.15-301.fc33.x86_64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v14.14.0
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error server@1.0.0 start: `node index.js`
22 error Exit status 1
23 error Failed at the server@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I even tried

1- cleaning cache, deleting node_modules and package-lock.json and followed by npm install
2- npm config set unsafe-perm true

But i m still getting the same error. Please help me, already wasted hours on it

Neil Duffy
experienced dev looking for extra work...
Samarth Saxena

Hey guys,
I need some advice on interservice communication in micro-services
Right new we are making rest API calls but that is inefficient so I thought of migrating it to kafka for interservice communication.
But I have a problem suppose I got an API call from the user and one of my microservices is relaying on other microservice to return the data which I cannot fulfill using kafka.

Later on the data which I got from microservice 2 will then be processed and sent back to the user

what is the optimal way to do it and how can I unblock this scenerio