Q:

Issue with installing npm bootstrap

I have installed the following version of bootstrap:
npm install bootstrap@4.0.0-alpha.3

included this line of code require("bootstrap/less/bootstrap.less") in abc.js file, when I am trying to compile the code I am getting
Module not found: Error: Cannot resolve module 'bootstrap/less/bootstrap.less'

error. Please help me in solving the issue.  

A:

First way (difficult)
You need to install the latest version Bootstrap 4
npm install bootstrap
https://getbootstrap.com/docs/4.1/getting-started/download/#npm
Import Bootstrap’s SASS by adding this line to your app’s entry point (usually index.js or app.js):
import "~bootstrap/scss/bootstrap";
https://getbootstrap.com/docs/4.1/getting-started/webpack/#importing-styles
Import Bootstrap’s JavaScript by adding this line to your app’s entry point (usually index.js or app.js):
import 'bootstrap';

or indicate the path completely
import 'bootstrap/dist/js/bootstrap';

or if you prefer require()
require('bootstrap/dist/js/bootstrap');

Alternatively, you may import plugins individually as needed:
import 'bootstrap/js/dist/util';
import 'bootstrap/js/dist/dropdown';
...

https://getbootstrap.com/docs/4.1/getting-started/webpack/#importing-javascript
Second way (easy)
Just plug in ready-made js and css to your page https://getbootstrap.com/docs/4.1/getting-started/introduction/
<! doctype html>
<html lang="en">
  <head>
    <!--  Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!--  Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <h1>Hello, world!</h1>

    <!--  Optional JavaScript -->
    <!--  jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
  </body>
</html>

