dotenv d’ont work with createConnection what should I use instead?

Without using my .env file it work but when I it use to create a connection it fail.

var mysql = require('mysql');
require('dotenv').config();

const db = mysql.createConnection({
    host: process.env.HOST,
    port: "3306",
    user: process.env.USER,
    password: process.env.PASSWORD,
    database: process.env.DATABASE
});
module.exports = db

I have this error.

error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

But I’m already up to date with the last mysql version.

Any idea ?

When to use onclick ={ myfuntion()} vs onclick={() => (myfunction())}

Why is the id undefined in the randomCard function when using the onClick= {(randomCard()}
and defined when using onClick = {() => (randomCard())}

function Home() {
    const [cardlist, setCardList] = useState([]);
    const navigate = useNavigate()
    
    function randomCard() {
        const index = Math.floor(Math.random() * cardlist.length);
        const id = cardlist[index].id;
        navigate(`/cards/${id}`)
    }  

    useEffect(() => {
        async function fetchData() {
            const res = await axios.get('https://db.ygoprodeck.com/api/v7/cardinfo.php');
            const results = res.data;
            setCardList(results.data);
            console.log(cardlist);
        }
        fetchData();
    }, [])

    return (
        <div className='home'>
            <h1>Welcome to the Yu-Gi-Oh Database</h1>
            <p>Choose Option</p>
            <div className="options">
                <ul>
                    <li><a href='/allcards'>Show All Cards</a></li>
                    <li><a href='/'>Search Card</a></li>                    
                    <li><a href='' onClick={() => (randomCard())}>Random Card</a></li>                    
                </ul>
               
            </div>
        </div>
  )
}

How to test nextjs endpoint using Jest?

I have an endpoint that handles user signup:

import { createToken } './token'; // Unable to mock
import { sendEmail } './email'; // Unable to mock

export default async function signUp(
  req: NextApiRequest,
  res: NextApiResponse
): Promise<any> {
  try {
    // Generate a verification token
    const token = await createToken(req.user);

    // Email the token
    await sendEmail(req.user, token);

    return res.status(200).send({ done: true });
  } catch (error: any) {
    console.error(error);
    return res.status(500).end(error.message);
  }
}

How do I mock the imported dependencies for my jest unit tests?

import signup from './signup';

describe('signup', () => {
  it('should return success', async () => {
    const req: IncomingMessage = {} as unknown as IncomingMessage;
    const res: ServerResponse = {
      end: jest.fn(),
    } as unknown as ServerResponse;

    const actual = await signup(req, res);

    ...
  });
});

Is it the case that Jest cannot actually mock these nested dependencies and some sort of DI pattern needs to be implemented here in the endpoint? If so, what DI patterns can I use to support unit tests for Nextjs endpoints?

owl-carousel-o is showing item vertically

i’m using Angular and i want to show items in normal way (using owl-carousel-o) , but that’s how they’re shown in the Link

that’s the app.component.ts code

    import { Component,OnInit, HostListener } from '@angular/core';
import { OwlOptions } from 'ngx-owl-carousel-o';
import { MatCarousel, MatCarouselComponent } from '@ngmodule/material-carousel';
import {MatBottomSheet, MatBottomSheetRef} from '@angular/material/bottom-sheet';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'projet';

  
  slides = [
    {'image': 'https://picsum.photos/seed/picsum/1200/300'}, 
    {'image': 'https://picsum.photos/seed/picsum/1200/300'},
    {'image': 'https://picsum.photos/seed/picsum/1200/300'}, 
    {'image': 'https://picsum.photos/seed/picsum/1200/300'}, 
    {'image': 'https://picsum.photos/seed/picsum/1200/300'}
  ];
// Product Slider
customOptions: any = {
    loop: false,
    dots: false,
    navSpeed: 300,
    responsive: {
        991: {
            items: 4
        },
        767: {
            items: 3
        },
        420: {
            items: 2
        }, 
        0: {
            items: 1
        }
    }
}
      slidesStore = [

      {id: "1", img: "https://dummyimage.com/350x150/423b42/fff"},

      {id: "2", img: "https://dummyimage.com/350x150/2a2b7a/fff"},

      {id: "3", img: "https://dummyimage.com/350x150/1a2b7a/fff"},

      {id: "4", img: "https://dummyimage.com/350x150/7a2b7a/fff"},


    ];
// <HTMLInputElement>document.getElementById("navbar");

}

this is HTML code

<owl-carousel-o [options]="customOptions">

    <ng-container *ngFor="let slide of slidesStore">
      <ng-template carouselSlide [id]="slide.id">
        <img [src]="slide.img" >
      </ng-template>
    </ng-container>

  </owl-carousel-o>

i did import it in app.module.ts

i’ve tried many solutions online but nothing works

any solution ?

How to list all members with a specific role with discord.js?

I try to make a simple bot that just lists all members that have a specific role.

I went through most of the similar questions I could find, but their answers seem outdated. So I tried this but end up with the result ‘undefined’, although the role exists.

const discord = require('discord.js');
const { Client, Intents } = require('discord.js');
const client = new discord.Client(
    { intents: [
        Intents.FLAGS.GUILDS, 
        Intents.FLAGS.GUILD_MESSAGES,
        Intents.FLAGS.GUILD_MEMBERS
    ] });


const prefix ="!";
const MemberID = "912852591023628371";

client.on('ready', () => {
    console.log('Connected to the bot');

  

});

client.on('messageCreate', msg => {
    if (msg.content === 'hi') {
        msg.reply('Hi to you too!');
    }
  
});

client.on('messageCreate', async message => {
    if (message.content === prefix + 'list') {
        let list = client.guilds.cache.get(MemberID);
        console.log(list);
        }
    }
);

jquery datatables issue on asp.net core 5

i followed all the steps to add jquery table but showing proccessing error

jquery datatables issue on asp.net core 5 i downlaod datatable and added the file and the same code work for another example

DataTables show Ajax error and not loaded the data

conroller code

    public IActionResult IndexGrid()
    {
        return View();
    }
    [HttpPost]

    public async Task<IActionResult> load()
    {
        var students = from s in _context.Students
                       select s;

        return Json(await students.ToListAsync());
    }

view code

<link href="~/lib/datatables/css/dataTables.bootstrap4.css" rel="stylesheet" />
<div class="container">
    <h3 class="text-primary">Customers</h3>
    <hr />

    <table id="Customers" class="table table-striped table-bordered dt-responsive nowrap">
        <thead>
            <tr>
                <th>Id</th>
                <th>LastName</th>
                <th>FirstMidName</th>
                <th>EnrollmentDate</th>
                
            </tr>
        </thead>
    </table>
</div>

@section Scripts
{
    <script src="~/lib/datatables/js/jquery.dataTables.js"></script>
    <script src="~/lib/datatables/js/dataTables.bootstrap4.js"></script>
    <script src="~/js/customersDatatable.js"></script>
}

custom js file

 $(document).ready(function () {
        $('#Customers').dataTable({
            "processing": true,
            "serverSide": true,
            "filter": true,
            "ajax": {
                "url": "/home/load",
                "type": "POST",
                "datatype": "json"
            },
            "columnDefs": [{
                "targets": [0],
                "visible": false,
                "searchable": false
            }],
            "columns": [
                { "data": "Id", "name": "Id", "autowidth": true },
                { "data": "FirstMidName", "name": "FirstMidName", "autowidth": true },
                { "data": "LastName", "name": "LastName", "autowidth": true },
                { "data": "EnrollmentDate", "name": "EnrollmentDate", "autowidth": true },
            
                {
                    "render": function (data, type, row) { return '<a href="#" class="btn btn-danger" onclick=DeleteCustomer("' + row.id + '"); > Delete </a>' },
                    "orderable": false
                },
    
            ]
        });
    });

Passing parameters in wireframe

I need your help. I am creating a wireframe; I have a table like the one shown in the code below.

I want to pass the parameters of the table (so item.id and item.n_a) present in the divA inside the divB.

The table is a dynamic table.

Can anyone kindly help me to do this?

.
.
.
xmlhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                var myArr = JSON.parse(this.responseText);
                var results = {};
                for (var i = 0, len = myArr.Items.length; i < len; i++) {
                    var id_art = myArr.Items[i].id_a;
                    if (id_art == id_url) {
                        results[i] = myArr.Items[i];
                    }
                }
Object.entries(results).forEach(item => {
  item = item[1];
  let child = document.createElement("tr");
  child.innerHTML = `
<td>${item.id}</td>
<td><${item.n_a}</td>`;
  table.appendChild(child);
  document.querySelector('#my-table').appendChild(child);
})

MATLAB to Javascript Code Conversion Issue

Suppose I have the following MATLAB code:

function xn=normalize(x)
xn=x/norm(x);
end

nTriangles=size(faces,1); 
    
trN=zeros(nTriangles,3);
for i=1:nTriangles
    trN(i,:)=normalize(cross(vert(faces(i,2),:)-vert(faces(i,1),:),...vert(faces(i,3),:)-vert(faces(i,1),:)));
end

I want to convert it to JavaScript using the math.js libraries.

I tried doing the following:

const math = require('mathjs')

function normalize(x){
return x/math.norm(x);}
    
let nTriangles = math.size(faces)[0];
let trNormals=math.zeros(nTriangles,3);
    for (let i = 0; i < nTriangles; i++) {
    let trN=math.row(trNormals,i);
    trN = normalize(math.cross(math.row(vert,math.subset(faces,math.index(i,1)))-math.row(vert,math.subset(faces,math.index(i,0))),... math.row(vert,math.subset(faces,math.index(i,2)))-math.row(vert,math.subset(faces,math.index(i,0)))));

However,this is wrong. I get an error:

Argument type number is not assignable to parameter type MathArray | Matrix

I keep trying to resolve the error, but to no success.
Can someone suggest how I can go about solving the issue or how I could else write the MATLAB code into JS?

On another note, the MATLAB code uses ,… while in Javascript this doesn’t seem to work.

Puppeteer action based on Javascript filter parent array based on child value

I haven an array containing a child array containing a label some div’s and a button.

MY goal is to click the button within the main <div.phoneinformation> only when the label is equal to “IOS”.
I have read this post, but I could not make it work.
All help is appreciated.

const list =[
{
 <div.phoneinformation>,
  ["<label>IOS</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 {
 <div.phoneinformation>,
  ["<label>ANDROID</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 {
 <div.phoneinformation>,
  ["<label>ANDROID</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 {
 <div.phoneinformation>,
  ["<label>IOS</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 {
 <div.phoneinformation>,
  ["<label>GOOGLE</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 {
 <div.phoneinformation>,
  ["<label>IOS</label>",
   "<div.version></div>",
   "<div.production-year></div>",
   "<div.info></div>",
   "<button></button>"],
 },
 
  
]

Replace word not in quotes

I’m looking to replace a word that’s not in quotes, whether single or double, accounting for escapes as well.

My test case:

Trying to replace

obj1 = {
  name: person,
  favoriteQuote: "I am my own person.",
}

person with "Joe".

Expected result:

obj1 = {
  name: "Joe",
  favoriteQuote: "I am my own person.",
}

I saw this question: Match and replace a word not in quotes (string contains escaped quotes) which I thought was similar and could be a good starting point the accepted answer does not work at all:

https://regex101.com/r/Lfan64/2

What’s a regex that could do this? Thanks.

Loading another html page (and all its scripts) into another page

We have a large html page, say A.html that takes various parameters and load data accordingly. Assume it is something like https://{mydomain}/{longpath}/A.html?someparam=large_string

It is on a static aws website with cloudfrount. I want to create another page say B.html that is at a url that looks more user friendly and has parameters as part of path. say https://{mydomain}/shortstring

This page or a lambda edge function that generates this page will decipher the path url and load the original page with right values set. We don’t want to return the large html page A.html on every access to this path in the expectation that loading of A.html can be better done from cache instead of losing the cache advantage at every shortstring url.

Is there a way to load A.html inside the B.html in such a way that the user only sees the user friendly urls in address bar ie https://{mydomain}/shortstring .

PS: Note this is different from redirecting to https://{mydomain}/{longpath}/A.html?someparam=large_string

Thanks in advance

Javascript if, else, else if, logical operators problem

Why is that not working?

So, I have a problem with my javascript code and i don’t know why my code isn’t working.
Maybe i don’t see a problem. I need a help.
I’ve tried everything, i don’t know why my code isn’t working :/

var oktet1 = 192;
var oktet2 = 256;
var oktet3 = 256;
var oktet4 = 256;

if(((oktet2 || oktet3 || oktet4) <= 255) || ((oktet2 || oktet3 || oktet4) >= 0)) {
    if((oktet1 >= 0) || (oktet1 <= 127)) {
        console.log("Adres ipv4: ");
        console.log(oktet1 + "." + oktet2 + "." + oktet3 + "." + oktet4);
        console.log("Klasa adresu: A");
        console.log("Maska sieci: 255.0.0.0");
    } else if((oktet1 > 127) || (oktet1 <= 191)) {
        console.log("Adres ipv4: ");
        console.log(oktet1 + "." + oktet2 + "." + oktet3 + "." + oktet4);
        console.log("Klasa adresu: B");
        console.log("Maska sieci: 255.255.0.0");
    } else if((oktet1 > 191) || (oktet1 <= 223)) {
        console.log("Adres ipv4: ");
        console.log(oktet1 + "." + oktet2 + "." + oktet3 + "." + oktet4);
        console.log("Klasa adresu: C");
        console.log("Maska sieci: 255.255.255.0");
    } else if((oktet1 > 223) || (oktet1 <= 239)) {
        console.log("Adres ipv4: ");
        console.log(oktet1 + "." + oktet2 + "." + oktet3 + "." + oktet4);
        console.log("Klasa adresu: D");
    } else if((oktet1 > 239) || (oktet1 <= 255)) {
        console.log("Adres ipv4: ");
        console.log(oktet1 + "." + oktet2 + "." + oktet3 + "." + oktet4);
        console.log("Klasa adresu: E");
    } else if(((oktet1 || oktet2 || oktet3 || oktet4) >= 255) || ((oktet1 || oktet2 || oktet3 || oktet4) <= 0)) {
        console.log("Nieprawidłowy adres. Podaj adres w zakresie od 0 do 255!");
    }
} else {
    console.log("Podaj prawidlowy adres ip w przedziale od 0 do 255");
}

Could not resolve all artifacts for configuration ‘:classpath’. Windows 10 2022 RN V 0.67

I installed react native version 0.67, following all the steps of the development environment setup at https://reactnative.dev/docs/environment-setup (So environment variables are fine). I am currently using windows 10 and I am using node LTS version 16.13.2 and java version 11. I have Android Studio Bumblebee and so far everything seems to be working fine when I use npx react-native start
to initialize metro. The problems come when I run npx react-native run-android

I’ll show the errors I get:

$ npx react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using
 "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reus
ed, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'IntentoXXVI'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download kotlin-reflect-1.4.31.jar (org.jetbrains.kotlin:kotlin-r
eflect:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-reflect/1.4.31/kotlin-reflect-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-reflect/1.4.31/kotlin-reflect-1.4.31.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-jdk7-1.4.31.jar (org.jetbrains.kotlin:kotl
in-stdlib-jdk7:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib-jdk7/1.4.31/kotlin-stdlib-jdk7-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib-jdk7/1.4.31/kotlin-stdlib-jdk7-1.4.31.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-1.4.31.jar (org.jetbrains.kotlin:kotlin-st
dlib:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib/1.4.31/kotlin-stdlib-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib/1.4.31/kotlin-stdlib-1.4.31.jar'.
            > Permission denied: connect
   > Could not download proguard-base-6.0.3.jar (net.sf.proguard:proguard-base:6
.0.3)
      > Could not get resource 'https://repo.maven.apache.org/maven2/net/sf/prog
uard/proguard-base/6.0.3/proguard-base-6.0.3.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/net/sf/proguard/p
roguard-base/6.0.3/proguard-base-6.0.3.jar'.
            > Permission denied: connect
   > Could not download error_prone_annotations-2.3.2.jar (com.google.errorprone
:error_prone_annotations:2.3.2)
      > Could not get resource 'https://repo.maven.apache.org/maven2/com/google/
errorprone/error_prone_annotations/2.3.2/error_prone_annotations-2.3.2.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/com/google/errorp
rone/error_prone_annotations/2.3.2/error_prone_annotations-2.3.2.jar'.
            > Permission denied: connect
   > Could not download commons-compress-1.12.jar (org.apache.commons:commons-co
mpress:1.12)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/apache/
commons/commons-compress/1.12/commons-compress-1.12.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/apache/common
s/commons-compress/1.12/commons-compress-1.12.jar'.
            > Permission denied: connect
   > Could not download animal-sniffer-annotations-1.18.jar (org.codehaus.mojo:a
nimal-sniffer-annotations:1.18)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/codehau
s/mojo/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/codehaus/mojo
/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-common-1.4.31.jar (org.jetbrains.kotlin:ko
tlin-stdlib-common:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib-common/1.4.31/kotlin-stdlib-common-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib-common/1.4.31/kotlin-stdlib-common-1.4.31.jar'.
            > Permission denied: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 42s

error Failed to install the app. Make sure you have the Android development envi
ronment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8
081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'IntentoXXVI'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not download kotlin-reflect-1.4.31.jar (org.jetbrains.kotlin:kotlin-r
eflect:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-reflect/1.4.31/kotlin-reflect-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-reflect/1.4.31/kotlin-reflect-1.4.31.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-jdk7-1.4.31.jar (org.jetbrains.kotlin:kotl
in-stdlib-jdk7:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib-jdk7/1.4.31/kotlin-stdlib-jdk7-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib-jdk7/1.4.31/kotlin-stdlib-jdk7-1.4.31.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-1.4.31.jar (org.jetbrains.kotlin:kotlin-st
dlib:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib/1.4.31/kotlin-stdlib-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib/1.4.31/kotlin-stdlib-1.4.31.jar'.
            > Permission denied: connect
   > Could not download proguard-base-6.0.3.jar (net.sf.proguard:proguard-base:6
.0.3)
      > Could not get resource 'https://repo.maven.apache.org/maven2/net/sf/prog
uard/proguard-base/6.0.3/proguard-base-6.0.3.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/net/sf/proguard/p
roguard-base/6.0.3/proguard-base-6.0.3.jar'.
            > Permission denied: connect
   > Could not download error_prone_annotations-2.3.2.jar (com.google.errorprone
:error_prone_annotations:2.3.2)
      > Could not get resource 'https://repo.maven.apache.org/maven2/com/google/
errorprone/error_prone_annotations/2.3.2/error_prone_annotations-2.3.2.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/com/google/errorp
rone/error_prone_annotations/2.3.2/error_prone_annotations-2.3.2.jar'.
            > Permission denied: connect
   > Could not download commons-compress-1.12.jar (org.apache.commons:commons-co
mpress:1.12)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/apache/
commons/commons-compress/1.12/commons-compress-1.12.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/apache/common
s/commons-compress/1.12/commons-compress-1.12.jar'.
            > Permission denied: connect
   > Could not download animal-sniffer-annotations-1.18.jar (org.codehaus.mojo:a
nimal-sniffer-annotations:1.18)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/codehau
s/mojo/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/codehaus/mojo
/animal-sniffer-annotations/1.18/animal-sniffer-annotations-1.18.jar'.
            > Permission denied: connect
   > Could not download kotlin-stdlib-common-1.4.31.jar (org.jetbrains.kotlin:ko
tlin-stdlib-common:1.4.31)
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrai
ns/kotlin/kotlin-stdlib-common/1.4.31/kotlin-stdlib-common-1.4.31.jar'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/jetbrains/kot
lin/kotlin-stdlib-common/1.4.31/kotlin-stdlib-common-1.4.31.jar'.
            > Permission denied: connect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 42s

    at makeError (C:UsersOrlando.ORLANDOCS1DesktopIntentoXXVInode_modules@
react-native-communitycli-platform-androidnode_modulesexecaindex.js:174:9)
    at C:UsersOrlando.ORLANDOCS1DesktopIntentoXXVInode_modules@react-nativ
e-communitycli-platform-androidnode_modulesexecaindex.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:UsersOrlando.ORLANDOCS1DesktopIntentoXXVIno
de_modules@react-native-communitycli-platform-androidbuildcommandsrunAndroi
drunOnAllDevices.js:109:5)
    at async Command.handleAction (C:UsersOrlando.ORLANDOCS1DesktopIntentoXX
[email protected]:192:9)
info Run CLI with --verbose flag for more details.

Clearly there are too many errors but the source of the problems (in my opinion) comes from the fact that the :classpath cannot be configured and other problems regarding gradle. I have not been able to solve it because similar questions have been asked in years like 2019 or 2018 and I have tried those solutions but they have not worked for me. I think it is because I am using more recent versions and I don’t know if that can cause problems, but these tools are the ones that are required of me, then I will show the gradle dependencies:

gradle.properties

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

I will be truly grateful for your answers, I have WEEKS stuck in this problem and I can’t find what else to do

How do I create a .js file that creates a navigation bar in html

Ok so, I am creating this site and I want every page to have a navigation bar, how do I make it so that instead of having to write the html for the navigation bar on every page, I just write in the .js file and add this javascript file to every page.

Btw, I’m not asking how to write a navigation bar in html, I’ve already done that.