0

In the following picture you can see the structure of my project on the left and on the right side is the list of all dependencies.

enter image description here

I typed the command "npm install" via gitbash, but when I view the page source, neither jquery nor bootstrap show.

How can I load jquery and bootstrap via npm? Hope you can help.

Sidney Sousa
  • 3,378
  • 11
  • 48
  • 99
  • You should type `npm install` in your `terminal` and not in your `gitbash` and also you should be in the same directory as your `package.json` – Anurag Singh Bisht Aug 09 '17 at 17:36
  • I don't think that this is an issue cause all other dependencies were successfully installed via gitbash. Well regardless I just tried quickly but still when I view the site I see nothing of bootstrap and jquery – Sidney Sousa Aug 09 '17 at 17:40
  • Are you checking inside your `node_modules` folder ? – Anurag Singh Bisht Aug 09 '17 at 17:41
  • Open `node_modules` folder, jquery and bootstrap must be there. – alexmac Aug 09 '17 at 17:41
  • And you can't see them in your `site`, without some additional work: build tool, etc – alexmac Aug 09 '17 at 17:42
  • @alexmac. Yes I see them in the nodules folder. How exactly can I make my header.html read them? – Sidney Sousa Aug 09 '17 at 17:45
  • Hope you can help me get away through this cause its my first time trying – Sidney Sousa Aug 09 '17 at 17:45
  • 1
    Possible duplicate of [How to include scripts located inside the node\_modules folder?](https://stackoverflow.com/questions/27464168/how-to-include-scripts-located-inside-the-node-modules-folder) – alexmac Aug 09 '17 at 17:48
  • Why not just use the CDN version on your index.html or download the min version and save it to your static directory – Felix Fong Aug 09 '17 at 18:00

1 Answers1

0

If you want to load front end components you can

  1. Use Bower, Grunt or Gulp or

  2. Use Webpack, with help of Webpack you can do everything directly in NPM

References:

https://webpack.js.org/

https://medium.com/javascript-training/introduction-to-using-npm-as-a-build-tool-b41076f488b0

zer0Id0l
  • 1,374
  • 4
  • 22
  • 36