How to optimise webpack build memory usage?

I have 500mb RAM limitation on render.com free plan, my webpack prod build takes up to 2gb RAM, so I’m unable to get successfull build there, as it goes above 500mb render.com kills the process and starts it over again.

I was able to reduce webpack build RAM usage to 560mb by disabling minification completely, sourcemaps generation.

What else can be done to reduce memory usage?

How to transform API output to columns for a table (UIBakery)

I am trying to map each array so I can use all objects in a table. I can’t figure out how to map the objects inside the billingDetails array.

Output API

{
invoiceRequests: [
{
    orderId: "987654",
    billingDetails: {
        firstName: "Eva",
        surname: "Jans",
        streetName: "Maasweg",
        houseNumber: "1",
        zipCode: "3943",
        city: "Paris",
        countryCode: "FR"
},

This is what I tried to transform the data

return [{{data}}].map(item => {
  return {
    Ordernumber: item.invoiceRequests.orderId,
    Firstname: item.invoiceRequests.billingDetails.firstName,
    Surname: item.invoiceRequests.billingDetails.surname,
    Street: item.invoiceRequests.billingDetails.streetName,
    Number: item.invoiceRequests.billingDetails.houseNumber,
    Postalcode: item.invoiceRequests.billingDetails.zipCode,
    Cicty: item.invoiceRequests.billingDetails.city,
    Country: item.invoiceRequests.billingDetails.countryCode,
    };
});

I receive this error:

{
name: "Error",
message: "item.invoiceRequests.billingDetails is undefined"
}

I am able to extract the orderId, this is only one array deep while the other objects are two arrays deep.

Hope you could help!

Kind regards,

Kevin

CastError: Cast to ObjectId failed for value “_method=DELETE” (type string) at path “_id” for model “Campground”

I am trying to add a delete route to an express application. this is the code so far

{const express = require('express');
const mongoose = require('mongoose');
const app = express();
const path = require('path');
const campground = require('./models/campground');
const methodOverride = require('method-override');

mongoose.connect('mongodb://127.0.0.1:27017/yelpcamp', { useNewUrlParser: true, useUnifiedTopology: true })
    .then(() => {
        console.log("CONNECTION OPEN!!!")
    })
    .catch(err => {
        console.log("OH NO ERROR!!!!")
        console.log(err)
    });

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.urlencoded({ extended: true }));
app.use(methodOverride('_method'))




app.get('/', (req, res) => { res.render('home') });
// app.get('/makeCampground', async (req, res) => {
//     const camp = new campground({
//         title: 'My backyard',
//         description: 'cheap camping!'
//     });
//     await camp.save();
//     res.send(camp);
// });

app.get('/campgrounds', async (req, res) => {
    const campgrounds = await campground.find({});
    res.render('campgrounds/index', { campgrounds });
});

app.get('/campgrounds/new', (req, res) => {
    res.render('campgrounds/new');
});

app.post('/campgrounds', async (req, res) => {
    const camp = await new campground(req.body.campground);
    await camp.save();
    res.redirect('/campgrounds');
});

app.delete('/campgrounds/:id', async (req, res) => {
    const { id } = req.params;
    await campground.findByIdAndDelete(id);
    res.redirect('/campgrounds');
});

app.get('/campgrounds/:id', async (req, res) => {
    const { id } = req.params;
    const foundCampground = await campground.findById(id);
    res.render('campgrounds/show', { foundCampground });
});

app.get('/campgrounds/:id/edit', async (req, res) => {
    const { id } = req.params;
    const foundCampground = await campground.findById(id);
    res.render('campgrounds/edit', { foundCampground });
});


app.put('/campgrounds/:id', async (req, res) => {
    const { id } = req.params;
    const campgroundBody = req.body;
    console.log(campgroundBody);
    await campground.findByIdAndUpdate(id, campgroundBody.foundCampground);
    const foundCampground = await campground.findById(id);
    // const campgrounds = await campground.find({});
    res.render('campgrounds/show', { foundCampground });
});


// app.delete('/campgrounds/:id', async (req, res) => {
//     const { id } = req.params;
//     await campground.findByIdAndDelete(id);
//     res.redirect('/campgrounds');
// });


app.listen('3000', () => {
    console.log('Serving on Port 3000');
});

I keep getting the cast error you see in the title. I am not sure what is the reason. I tried changing the order of the routes but to no avail

I am not sure what is the reason. I tried changing the order of the routes but to no avail.

Filter HTML table with grouped rows using JQuery

I have a table that needs to be filtered based on the packaging type, country, postage service.

The filter for just the packaging type seems to work ok but if I were to filter then by the country or postage service the table would go out of place. I guess this is due to the row span.

Object.keys(groupedRateCards).forEach(function (packageType) {
        var packageRateCards = groupedRateCards[packageType];

        var packageTypeRowCount = getRowCount(packageRateCards);

        packageRateCards.forEach(function (rateCard, index) {
            var dataRow = $('<tr>');

            // Add the data-packaging-type attribute
            dataRow.attr('data-packaging-type', rateCard['PackageType']);
            dataRow.attr('data-country-zone', rateCard['Country_zone']);
            dataRow.attr('data-postage-type', rateCard['Postage Service']);

            if (index % packageTypeRowCount === 0) {
                dataRow.append('<td rowspan="' + packageTypeRowCount + '"><input class="form-control" type="text" value="' + rateCard['PackageType'] + '" disabled="disabled"></td>');
            }

            var countryZoneRowCount = getRowCountForCountryZone(packageRateCards, rateCard['Country_zone']);
            if (index % countryZoneRowCount === 0) {
                dataRow.append('<td rowspan="' + countryZoneRowCount + '">' + rateCard['Country_zone'] + '</td>');
            }

            dataRow.append('<td>' + rateCard['Postage Service'] + '</td>');
            //rest of code..
});


function groupBy(arr, property) {
  return arr.reduce(function(acc, obj) {
    var key = obj[property];
    if (!acc[key]) {
      acc[key] = [];
    }
    acc[key].push(obj);
    return acc;
  }, {});
}

function getRowCount(arr) {
  return arr.length;
}

function getRowCountForCountryZone(arr, countryZone) {
  return arr.filter(function(obj) {
    return obj['Country_zone'] === countryZone;
  }).length;
}

I don’t know if you need to see my javascript on how the table is built but I have included a snippet on how those specific tr’s are created I created a JFiddle where the issue can be reproduced and i’ve included the JS for the filtering logic.

https://jsfiddle.net/f8Lg6ts0/

I’m unsure on what sort of logic I can do here. Does the row span need to be dynamic?

React native password show hide /Password Show Hide methode in react native

React native password show hide /Password Show Hide methode in react native

import React from 'react';
import {SafeAreaView,TouchableOpacity, StyleSheet, TextInput, Image} from 'react-native';

const TextInputExample = () => {
  const [password, onChangePassword] = React.useState('');
  const [show, onChangeShow] = React.useState(true);

  return (
    <SafeAreaView style={{flexDirection:'row', alignItems:'center'}}>
      <TextInput style={{height: 40,margin: 12,borderWidth: 1,padding: 10,}}
        onChangeText={onChangePassword}
        value={password}
        secureTextEntry={show}
      />
      <TouchableOpacity onPress={() => onChangeShow((current) => !current)}>  
       <Image style={{width:10,height:10}} source={{uri:'https://static.vecteezy.com/system/resources/thumbnails/009/393/680/small/eye-icon-sign-symbol-design-free-png.png'}}/>
      </TouchableOpacity>
    </SafeAreaView>
  );
};

export default TextInputExample;

How to properly toggle a class in React

I have a button with a popover attached and once clicked on the button, is-selected class should be added to the classList (to highlight the button)

enter image description here.

In Plain Javascript it works fine,but the problem is when using React. When debugging, the class is indeed added but then some Mutations happens and it’s removed. In pretty new in React and maybe I don’t understand how it works. Here is what my react component returns

return (
    <div
        data-controller="s-popover"
        data-s-popover-toggle-class="is-selected"
        data-s-popover-placement="bottom"
        data-s-popover-reference-selector={`#${buttonId}`}
    >
        <MenuButton
            id={buttonId}
            data-key={id}
            iconName={iconName}
            command={() => true}
            ariaControls={popoverId}
            dataAction="s-popover#toggle"
            data-controller="s-tooltip"
            active={active}
        />
        <MenuPopover id={popoverId} children={children} nCols={nCols} />
    </div>
);

and

data-s-popover-toggle-class="is-selected"

is what is used in the above screen.

Is it possible to precalculate javascript with a static output?

I’ve got a fairly simple script, taken from another question on here;

fetch( 'https://example.com/file.md' )
  .then( response => response.text() )
  .then( (result) => {
    var content = marked.parse(result);
    document.querySelector( '#my-container' ).innerHTML = content;
  });

It takes a markdown file, and using marked generates HTML.

My intention is for the site to be static, and it feels like it’s a waste doing the conversion every time on the client with Javascript. However, I want some sort of automatic process to convert from the Markdown I’m writing in to the raw HTML.
Initially I thought there might be a preprocessor I could use, but after researching I’ve not been able to find one that suits my needs.

Since the output of the Javascript will always be the same, is there a way to essentially precalculate or cache the result of this script, generating a static HTML file?

Cannot read properties of undefined (reading ‘findAll’)

I’m trying to import data from my mysql database to my index.ejs file, but it keeps giving me several errors, I’ve tried to correct it and I couldn’t, my index.ejs file is not recognizing the ejs syntax.

this is my file to generate the routes with express

const express = require('express');
const app = express();
const fs = require('fs');
const db = require('./models/db');
const path = require('path');

//para colocar conteúdo dinâminco no html
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');



//para utilizar arquivos estáticos no node (css, js)
app.use(express.static(path.join(__dirname,"public")));

//manda infos para o front
 app.get("/", async (req, res) => {

    try{
      const usuario = await db.usuario.findAll();

      res.render('index', { usuario });
    }
    catch (error) {
      console.error('Erro ao buscar produtos:', error);
      res.status(500).send('Erro interno do servidor');
    }


 });

 //recebe infos e manda para o banco de dados
 app.post("/imput", async (req, resp) => {
   res.send
 })

 //se conecta a porta 8080 do localhost
 app.listen(8080, () => {
    console.log("servidor iniciado na porta 8080: http://localhost:8080");
 });

and this is my index.ejs

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cadastro</title>
    <link rel="shortcut icon" href="https://engixelevadores.com.br/public/template/assets/images/favicon/favicon.png" type="image/x-icon">
    <link rel="stylesheet" href="./style/style.css">
   

    <script src="script.js"> </script>
        
</head>

<body>
    <div class="container">
        <h1>Cadastro</h1>

        <!--Forms de cadastro de infos dos clientes, utilizando de uma api para facilitar o preenchimento do endereço-->
        <form id="addresForm" action="/submit" method="post">

            <div class="infos1">

                <label for="codigo">Código: <br></label>
                <input type="text" name="codigo" id="codigo" required> 
                <br>

                <label for="nome">Nome: <br></label>
                <input type="text" name="nome" id="nome" required>
                <br>

                <label for="cpf_cnpj">CPF/CNPJ: <br></label>
                <input type="number" name="cpf_cnpj" id="cpf_cnpj" placeholder="Apenas números">
                <br>

                <label for="pf_pj">Tipo: <br></label>
                <label>
                    <input type="radio" name="pf_pj" id="pf_pj" value="pf">
                    PF
                </label>
                
                <label>
                    <input type="radio" name="pf_pj" id="pf_pj" value="pj">
                    PJ
                    <br><br>
                </label>

                <label for="onde_encontrou_emp">Como conheceu a Engix? <br></label>

                <label for="onde_encontrou_emp">
                    <input type="radio" name="onde_encontrou_emp" id="onde_encontrou_emp" value="Indicação">
                    Indicação
                    <br>
                </label>

                <label for="onde_encontrou_emp">
                    <input type="radio" name="onde_encontrou_emp" id="onde_encontrou_emp" value="Redes Sociais">
                    Redes Sociais
                    <br>
                </label>

                <label for="onde_encontrou_emp">
                    <input type="radio" name="onde_encontrou_emp" id="onde_encontrou_emp" value="Google">
                    Google
                    <br>
                </label>

                <label for="onde_encontrou_emp">
                    <input type="radio" name="onde_encontrou_emp" id="onde_encontrou_emp" value="Google">
                    Comercial
                    <br>
                </label>

                <label for="onde_encontrou_emp">
                    <input type="radio" name="onde_encontrou_emp" id="onde_encontrou_emp" value="Outro">
                    Outros
                    <input type="text" name="onde_encontrou_emp" id="onde_encontrou_emp">
                </label>
            </div>

            <div class="infos2">


                <!--Chama a function pesquisacep que está no arquivo script.js, ela fará a consulta em um banco de dados externo e autocompletará os campos abaixo-->
                <label for="cep">CEP: <br></label>
                <input type="text" name="cep" id="cep" size="15" maxlength="9" onblur="pesquisacep(this.value);" placeholder="Apenas números">
                <br>

                <label for="rua">Rua: <br></label>
                <input type="text" name="rua" id="rua" size="50">
                <br>

                <label for="numero">Numero: <br></label>
                <input type="text" name="numero" id="numero" size="50">
                <br>

                <label for="bairro">Bairro: <br></label>
                <input type="text" name="bairro" id="bairro" size="50">
                <br>

                <label for="cidade">Cidade: <br></label>
                <input type="text" name="cidade" id="cidade" size="50">
                <br>

                <label for="uf">UF: <br></label>
                <input type="text" name="uf" id="uf" size="50">

            </div>

            <div class="infos3">

                <label for="contato_cliente">Nome do contato: <br></label>
                <input type="text" name="contato_cliente" id="contato_cliente">
                <br>

                <label for="telefone">Nº Telefone fixo: <br></label>
                <input type="tel" name="telefone" id="telefone" placeholder="Apenas números">
                <br>

                <label for="celular">Nº Celular: <br></label>
                <input type="tel" name="celular" id="celular" placeholder="Apenas números">
                <br>

                <p>Se não houver DDD, ele será <br> definido automaticamente como (51)</p>
            </div>

            <div class="infos4">

                <label for="responsavel">Responsável:</label>

                <select name="responsavel" id="responsavel" autofocus >

                   ** <% usuario.forEach( => { %>
                        <option value="<%= usuario.id %>"><%= usuario.nome %></option>
                      <% }); %>**

                </select>
                
                <br>

                <label for="tipo_equipamento">Tipo de equipamento:</label>

                <select name="tipo_equipamento" id="tipo_equipamento" autofocus >
                    <option value="PNE">PNE</option>
                    <option value="Elevador Comercial">Elevador Comercial</option>
                    <option value="Elevador Residencial">Elevador Residencial</option>
                    <option value="Não informado">Não informado</option>
                </select>
                
                <br>

                <label for="tipo_equipamento">Tipo de equipamento:</label>

                <select name="tipo_equipamento" id="tipo_equipamento" autofocus >
                    <option value="PNE">PNE</option>
                    <option value="Elevador Comercial">Elevador Comercial</option>
                    <option value="Elevador Residencial">Elevador Residencial</option>
                    <option value="Não informado">Não informado</option>
                </select>

            </div>
        </form>


    </div>
    
</body>
</html>

was for the data to be loaded in the select

How do I remove the FadeOut/fadeIn property from a div after the page is refreshed? [closed]

подскажите пожалуйста, можно ли как-то сбросить свойства FadeOut и FadeIn во время обновления страницы, необходимо для загрузочного экрана.

$(document).ready(function(){
    $(window).scroll(function(){
        if($(window).scrollTop()>50){
            $('.ip-logo').fadeOut(0)
        }else{
            $('.ip-logo').fadeIn(0)
        }
    });
    
});

Обыскал весь интернет и никак не могу найти, подскажите пожалуйста. Спасибо

AngularJS website errors because of session expired on reverse proxy

I’m managing an AngularJS website behind a reverse proxy used for authentication.
After a few hours, that session on the reverse proxy expires.

If the website is still open in a browser, and a user click on a page, the framework will return javascript which contains not javascript, but the HTML of the reverse proxy login page, starting with <!DOCTYPE html>

This can’t be parsed and provoke an error "Uncaught SyntaxError: expected expression, got '<'"
The whole page is black because of these errors.
A workaround then is to refresh the page, but all of our users don’t know it.

What can I do to fix the problem gracefully ?

How to sort the javascript array of object on key basis

I want to sort the array on key acceding order as I have describe bellow:
I have an array:

[
{ "FirstName": "Manu" },
{ "LastName": "Mathew" },
{ "Gender": "Male" },
{ "DateofBirth":"1985-05-5" }
]

I want array sort like this :
[
{ "DateofBirth":"1985-05-5" }
{ "FirstName": "Manu" },
{ "Gender": "Male" },
{ "LastName": "Mathew" },
]

Pendo Guide Poll – How to create a multi-Select polls with checkbox’s

I want to be able to create a multiple checkbox poll for the first step (STEP 1) of the “pendo guide” and a radio button poll for the next step (STEP 2)

Here some question examples from the poll:

STEP 1

[Q is required to answer to move to step 2]

Q: Which communication or collaboration software do you use? [select all that apply]

((The user would be able to select multiple options from the list below))

– Slack

– Google Chat

– Microsoft Teams

– Zoom

– None of the above

STEP 2

[Q is required to answer to move to submit the poll]

Q: How much time daily are you on your mobile? [select one]

((The user would be able to select only 1 option from the list below))

– 2-4 hours

– 4-6 hours

– 6-9 hours

– 9-12 hours

– 12-16 hours

—————-

Thanks for your help!

I was triying to edit the code in html [Pendo Guide - Edit Code ](https://i.stack.imgur.com/lW1GQ.png)

Here is the HTML:

<!DOCTYPE html>
<html>
<head>
  <title>Multi-Select Checkbox Poll</title>
  <script src="https://cdn.pendo.io/agent/static/<YOUR_PENDO_TRACKING_ID>/pendo.js"></script>
  <style>
    .pollContainer {
      font-size: 14px;
        color: rgb(17, 17, 17);
      font-weight: 400;
      position: relative;
      float: none;
      vertical-align: baseline;
      margin: 0px 0px 8px;
      padding: 0px;
      font-size: 13px;
      letter-spacing: 0px;
      line-height: 1.5;
      overflow-wrap: break-word;
      text-transform: none;
      font-family: Helvetica;
      text-decoration: none;
      text-align: left;
    }

    h2, h3 {
      color: rgb(83, 82, 82);   
      font-weight: 200;
      position: relative;
      float: none;
      vertical-align: baseline;
      margin: 0px 0px 8px;
      padding: 0px;
      font-size: 14px;
      letter-spacing: 0px;
      line-height: 1.5;
      overflow-wrap: break-word;
      text-transform: none;
      font-family: Helvetica;
      text-decoration: none;
      text-align: left;
    }

    input[type="checkbox"], button {
      font-size: 14px;
    } 
    }
  </style>
</head>
<body>
    
    
  <div class="pollContainer" id="question1Container">
    <h3>1. Which communication or collaboration software do you use? ? Select all that apply.</h3>
    <input type="checkbox" name="option" value="Slack" required>Slack<br>
    <input type="checkbox" name="option" value="Google Chat" required>Google Chat<br>
    <input type="checkbox" name="option" value="Microsoft Teams" required>Microsoft Teams<br>
    <input type="checkbox" name="option" value="Zoom" required>ZoomTeams<br>
    <input type="checkbox" name="option" value="None of the above" required>None of the above<br>
  </div>


  <div class="pollContainer" id="question3Container">
    <h3>3. How much time daily are you on your mobile? select one.</h3>
    <input type="checkbox" name="option" value="2-4 hours" required>2-4 hours<br>
    <input type="checkbox" name="option" value="4-6 hours" required>4-6 hours t<br>
    <input type="checkbox" name="option" value="6-9 hours" required>6-9 hours<br>
    <input type="checkbox" name="option" value="9-12 hours" required>9-12 hours<br>  
  </div>

here is the Javascript:

var requiredQuestions = [];
var requiredPollIds = [];
var dependentButtons = [];
var textForDisabledButtons = ["Submit", "Next", "Finish"];
var isButtonDisabled = false;

function requiredHTML(dataPendoPollId) {
    return '<div class="required-wrapper" name="' +  dataPendoPollId + '">* Required</div>'; 
} 

function disableEligibleButtons(textForDisabledButtons) {
    for(var i=0; i < textForDisabledButtons.length; i++) {
        var eligibleButtons = pendo.dom("._pendo-button:contains('" + textForDisabledButtons[i] + "')");
        for (var k=0; k < eligibleButtons.length; k++) {
            eligibleButtons[k].disabled = true;
        }
    }
}

function enableEligibleButtons(textForDisabledButtons) {
    for(var i=0; i < textForDisabledButtons.length; i++) {
        var eligibleButtons = pendo.dom("._pendo-button:contains('" + textForDisabledButtons[i] + "')");
        for (var k=0; k < eligibleButtons.length; k++) {
            eligibleButtons[k].disabled = false;
        }
    }
}

if(!pendo.designerEnabled) {
    function processRequiredQuestions() {
        requiredQuestions = pendo.dom("._pendo-open-text-poll-question:contains('[REQUIRED]'), ._pendo-number-scale-poll-question:contains('[REQUIRED]'), ._pendo-multi-choice-poll-question:contains('[REQUIRED]')");
        for(i=0; i<requiredQuestions.length; i++) {
            var dataPendoPollId = requiredQuestions[i].getAttribute("data-pendo-poll-id");
            requiredPollIds.push(dataPendoPollId);
            if(pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0]) {
                pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0].parentElement.parentElement.insertAdjacentHTML('afterEnd', requiredHTML(dataPendoPollId));
            } else {
                pendo.dom(".pendo-block-wrapper[data-pendo-poll-id='" + dataPendoPollId + "']")[0].parentElement.parentElement.insertAdjacentHTML('afterEnd', requiredHTML(dataPendoPollId));
            }
            requiredQuestions[i].innerHTML = requiredQuestions[i].innerHTML.replace("[REQUIRED]", "");
        }
        if(requiredPollIds.length>0) {
            disableEligibleButtons(textForDisabledButtons);
        }
    }

    function evaluateRequiredQuestions() {
        var allRequiredComplete = true;
        for(var i = 0; i < requiredPollIds.length; i++) {
            if (pendo.dom("._pendo-open-text-poll-wrapper[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0]) {
                if(pendo.dom("._pendo-open-text-poll-wrapper[data-pendo-poll-id='" + requiredPollIds[i] + "'] textarea")[0].value == "") {
                    var allRequiredComplete = false;
                }
            }
            if (pendo.dom("._pendo-number-scale-poll-wrapper[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0]) {
                if(!(pendo.dom("._pendo-number-scale-poll-wrapper[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0].querySelector(':checked'))) {
                    var allRequiredComplete = false;
                }
            }
            if (pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0]) {
                if(!(pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredPollIds[i] + "']")[0].querySelector(':checked'))) {
                    var allRequiredComplete = false;
                }
            }
        }

        if (allRequiredComplete) {
            enableEligibleButtons(textForDisabledButtons);
        } else {
            disableEligibleButtons(textForDisabledButtons);
        }
    }

    processRequiredQuestions();

    document.querySelectorAll("._pendo-open-text-poll-input").forEach(textbox => {
        textbox.addEventListener("input", function() {
            evaluateRequiredQuestions();
        })
    })

    pendo.dom("#pendo-guide-container")[0].addEventListener("click", function(){
        if(!event.target.classList.contains("_pendo-button")) {
           evaluateRequiredQuestions(); 
        }
    });

}

if(pendo.designerEnabled) {                          
    addRequiredMutationListener = function() {
        var target = document.querySelector('#pendo-guide-container');

        // create an observer instance
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                if (mutation.addedNodes.length) {
                    // Add requiredToggle if new Open Text Poll is added
                    if(mutation.addedNodes[0].querySelector("._pendo-open-text-poll-wrapper, ._pendo-number-scale-poll-wrapper, ._pendo-multi-choice-poll-select-border")) {
                        var dataPendoPollId = "";
                        if(mutation.addedNodes[0].querySelector("._pendo-open-text-poll-wrapper, ._pendo-number-scale-poll-wrapper")) {
                            var dataPendoPollId = mutation.addedNodes[0].querySelector("form").getAttribute("name");
                        } else {
                            var dataPendoPollId = mutation.addedNodes[0].querySelector("._pendo-multi-choice-poll-select-border").getAttribute("data-pendo-poll-id");
                        }

                        var questionText = "";
                        if(pendo.dom("._pendo-open-text-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0]) {
                            questionText = pendo.dom("._pendo-open-text-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0].textContent;
                        }
                        if(pendo.dom("._pendo-number-scale-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0]) {
                            questionText = pendo.dom("._pendo-number-scale-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0].textContent;
                        }
                        if(pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0]) {
                            questionText = pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=" + dataPendoPollId + "]")[0].textContent;
                        }                           
                        

                        if(questionText.includes("[REQUIRED]")){
                            mutation.addedNodes[0].insertAdjacentHTML('afterEnd', requiredHTML(dataPendoPollId));
                            if(requiredQuestions.includes(dataPendoPollId)) {
                                var index = requiredQuestions.indexOf(dataPendoPollId);
                                if (index !== -1) {
                                    requiredQuestions.splice(index, 1);
                                }
                            } else {
                                requiredQuestions.push(dataPendoPollId);
                            }
                            
                        } else {
                            if(requiredQuestions.includes(dataPendoPollId)) {
                                var index = requiredQuestions.indexOf(dataPendoPollId);
                                if (index !== -1) {
                                requiredQuestions.splice(index, 1);
                                }
                            }
                        }
                    }

                    var allRequiredComplete = true;
                    for(var i = 0; i < requiredQuestions.length; i++) {
                        if (pendo.dom("._pendo-open-text-poll-wrapper[data-pendo-poll-id='" + requiredQuestions[i] + "']")[0]) {
                            if(pendo.dom("._pendo-open-text-poll-wrapper[data-pendo-poll-id='" + requiredQuestions[i] + "'] textarea")[0].value == "") {
                                var allRequiredComplete = false;
                            }
                        }
                        if (pendo.dom("._pendo-number-scale-poll-wrapper[data-pendo-poll-id='" + requiredQuestions[i] + "']")[0]) {
                            if(!(pendo.dom("._pendo-number-scale-poll-wrapper[data-pendo-poll-id='" + requiredQuestions[i] + "']")[0].querySelector(':checked'))) {
                                var allRequiredComplete = false;
                            }
                        }
                        if (pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredQuestions[i] + "']")[0]) {
                            if(!(pendo.dom("._pendo-multi-choice-poll-select-border[data-pendo-poll-id='" + requiredQuestions[i] + "']")[0].querySelector(':checked'))) {
                                var allRequiredComplete = false;
                            }
                        }
                    }

                    if (allRequiredComplete) {
                        enableEligibleButtons(textForDisabledButtons);
                    } else {
                        disableEligibleButtons(textForDisabledButtons);
                    }
                }
            })
        });
                

        var config = {
            attributeFilter: ['data-layout'],
            attributes: true,
            childList: true,
            characterData: true,
            subtree: false
        };

        observer.observe(target, config);
    }

    addRequiredMutationListener();
}

Cannot find module http-errors

I am having this error with npm start command where i am facing issue with my node.js services.

Node.js v18.16.0

We have already tried
npm i -g stylelint@version npm install @types/node --save
, but still facing issues.

Here is my package.json file

Here is the attached package.json file

{
  "name": "iscoper-step-coverage",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node bin/www"
  },
  "lint-staged": {
    "*.js": [
      "prettier --write",
      "eslint --fix"
    ]
  },
  "dependencies": {
    "@sap/hdbext": "^7.1.4",
    "@sap/xsenv": "^3.1.0",
    "@sap/xssec": "^3.1.2",
    "axios": "^0.21.1",
    "cookie-parser": "~1.4.4",
    "cron": "^1.8.2",
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "http-errors": "~1.6.3",
    "jade": "~1.11.0",
    "morgan": "~1.9.1",
    "sap-cf-axios": "^0.2.30"
  },
  "devDependencies": {
    "eslint": "^8.6.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-prettier": "^4.0.0",
    "husky": "^7.0.0",
    "lint-staged": "^12.1.5",
    "nodemon": "^2.0.7",
    "prettier": "^2.5.1"
  }
}

Make a scroll effect inside laptop screen image

I want to make a scrolling effect when scrolling the page it should scroll inside a laptop image. Like here but responding to mouse scroll on the page and not on hover.

Any ideas?

Thank you so much for your help!!

I tried to cheat by overlapping the laptop image and the screen content making one fixed and one overflow-y:scroll, but it is too hard to implement and make responsive and it feels wrong.