I am unable to run a Node.js application because of jquery

Asked

Viewed 65 times

0

I tried to install a bootstrap in a Node.js application, then installed jquery and Popper.js, but now when I run my application this giving the following error.

var version = $.fn.jquery.split(' ')[0].split('.');
TypeError: Cannot read property 'jquery' of undefined

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • You are using jquery on the client or server side?

  • Already tried to use, in the file customer.ejs the jQuery "normal" instead of the version slim?

  • @Maurydeveloper I’m using on the client side.

  • @Valdeirpsr used the normal jQuery and the slim and neither of the two is working

  • You actually discovered an error in Jquery lib, because it didn’t work for me when I tested it. : v

1 answer

0


I figured out how to solve, I did it like this, I used jQyery from Google’s Cdn to get jQuery so my script was like this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>

and my link

<link rel="stylesheet" href="/node_modules/bootstrap/dist/js/bootstrap.js">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.