‘require’ keyword not being recognized by webstorm

In Webstorm, there are three places in your settings (ctrl-alt-s) where you can update settings for Node.js projects. Settings: Javascript Libraries First, in Javascript | Libraries you can specify that Node libraries should be loaded. Your set of libraries may look different than this, but it should be pretty close…or, if needed, you can add … Read more

TypeError: req.session.regenerate is not a function using Passport

Am doing the same course, fix is there on udemy. From Udemy : Passport v.0.6.0 is currently broken due to an incompatibility: https://github.com/jaredhanson/passport/issues/907 The maintainer suggests using the latest v0.5.0 until a fix is pushed out. Use: npm uninstall passport npm install [email protected] this worked fine for me.

How to set log level in Winston/Node.js

If you are using the default logger, you can adjust the log levels like this: const winston = require(‘winston’); // … winston.level=”debug”; will set the log level to ‘debug’. (Tested with winston 0.7.3, default logger is still around in 3.2.1). However, the documentation recommends creating a new logger with the appropriate log levels and then … Read more

Glob / minimatch: how to gulp.src() everything, then exclude folder but keep one file in it

This seems to work: gulp.src([ baseDir + ‘/**’, // Include all ‘!’ + baseDir + ‘/excl1{,/**}’, // Exclude excl1 dir ‘!’ + baseDir + ‘/excl2/**/!(.gitignore)’, // Exclude excl2 dir, except .gitignore ], { dot: true }); Excluding single file from glob match was tricky because there’s no similar examples in minimatch docs. https://github.com/isaacs/minimatch “If the … Read more

Embed image in email body nodemailer nodejs

Responding here in case anyone else encounters this! The __dirname above was really helpful, but this is my code to actually see the image embedded in the email My img tag: <img src=”https://stackoverflow.com/questions/48449379/cid:logo”> My attachments snippet: attachments: [{ filename: ‘Logo.png’, path: __dirname +’/folder/Logo.png’, cid: ‘logo’ //my mistake was putting “cid:logo@cid” here! }]

How to get all html data after all scripts and page loading is done? (puppeteer)

If you want full html same as inspect? Here it is: const puppeteer = require(‘puppeteer’); (async function main() { try { const browser = await puppeteer.launch(); const [page] = await browser.pages(); await page.goto(‘https://example.org/’, { waitUntil: ‘networkidle0’ }); const data = await page.evaluate(() => document.querySelector(‘*’).outerHTML); console.log(data); await browser.close(); } catch (err) { console.error(err); } })();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)