How to check confirm password with zod

You can achieve this by tacking on a superRefine export const registerUserSchema = z.object({ firstName: z.string(), lastName: z.string(), userName: z.string(), email: z.string().email(), phone: z.string().transform(data => Number(data)), password: z.string().min(4), confirmPassword: z.string().min(4), avatar: z.string().optional(), isVerified: z.boolean().optional() }).superRefine(({ confirmPassword, password }, ctx) => { if (confirmPassword !== password) { ctx.addIssue({ code: “custom”, message: “The passwords did not match” … Read more

How to resolve “Error: error:0308010C:digital envelope routines::unsupported” Nodejs 18 error [duplicate]

In my case this happened in my Github Actions build pipeline when I was running npm run build. I was able to fix it by providing the following environment argument: export NODE_OPTIONS=–openssl-legacy-provider According from what I have read this node option can also be set in package.json. What I did was modifying the scripts section … Read more

Puppeteer not rendering color, background color when I try to save PDF on disk

Puppeteer is just a library to drive Chrome/Chromium, so if anything goes wrong while using it, our best bet is to open Chromium with puppeteer.launch({headless:false}) and debug there. Set your page css in <style></style> tag. You can solve the issue with the following CSS code: html { -webkit-print-color-adjust: exact; } p { color: #FF0000; }

How can I use “exports” in package.json for nested submodules and TypeScript?

Node.js has supported exports since v12.7.0 (Jul. 2019) When I asked this question (Dec. 2021), NodeJS had supported the exports field for nearly 2.5 years. It seemed reasonable to assume that Typescript supported it. The latest version of TypeScript at that time (4.5) did not support the exports field. This was particularly confusing because the … Read more

node.js how to check a process is running by the process name?

You can use the ps-node package. https://www.npmjs.com/package/ps-node var ps = require(‘ps-node’); // A simple pid lookup ps.lookup({ command: ‘node’, psargs: ‘ux’ }, function(err, resultList ) { if (err) { throw new Error( err ); } resultList.forEach(function( process ){ if( process ){ console.log( ‘PID: %s, COMMAND: %s, ARGUMENTS: %s’, process.pid, process.command, process.arguments ); } }); }); … Read more

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