0

I have added the script tags for jquery, tether and bootstrap but still getting the below error

enter image description here

I have copied the starter template from Bootstrap's website and trying to use it in an electron app.

Here is my basic HTML template Electron is displaying :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Chap 01</title>
    
    <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
    
    
</head>
<body>
    <div class="container">
        <div class="jumbotron">
            Electron Demo
        </div>
    </div>
    <!--<script src="node_modules/jquery/dist/jquery.js" lang="javascript"></script>
    <script src="node_modules/tether/dist/js/tether.min.js" lang="javascript"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js" lang="javascript"></script>-->
    
    <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</body>
</html>

I tried using the node_modules folder too. Same error. Can anybody help me out here as to why I am getting the error.

index.js

const electron = require('electron');
const { app, BrowserWindow } = electron;

app.on('ready', () => {
 const mainWindow = new BrowserWindow({});
mainWindow.loadURL(`file://${__dirname}/index.html`);
});
Abhilash D K
  • 1,223
  • 1
  • 23
  • 39

2 Answers2

0

Links are wrong, try following Bootstrap 4 Beta instead of Alpha, it works perfect:

<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Chap 01</title>
        
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
        
        
    </head>
    <body>
        <div class="container">
            <div class="jumbotron">
                Electron Demo
            </div>
        </div>
        <!--<script src="node_modules/jquery/dist/jquery.js" lang="javascript"></script>
        <script src="node_modules/tether/dist/js/tether.min.js" lang="javascript"></script>
    <script src="node_modules/bootstrap/dist/js/bootstrap.min.js" lang="javascript"></script>-->
        
        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
    </body>
    </html>
SilverSurfer
  • 4,281
  • 6
  • 24
  • 50
  • Hi, this is also not working in Electron app. But if I open the same index.html normally in Google Chrome there is no error. Any ideas why. Am I missing anything in the electron app. I am adding the index.js file too to my question please look into it. – Abhilash D K Sep 30 '17 at 04:45
0

Try this Jquery tag instead of slim.min.js.

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

Hope it helps.

TidyDev
  • 3,470
  • 9
  • 29
  • 51
  • Hi @TidyDev, yes this worked as well the code SilverSurfer has suggested in Google Chrome when I opened index.html normally. But when it is loaded through Electron it is giving the same error. Am I missing anything. – Abhilash D K Sep 30 '17 at 04:48