node.js - bootstrap installed via npm throws error about "Error: Cannot find module 'jQuery'" -


i'm new node , npm , express.js still learning. on bootstrap website can use bootstrap using npm install, , did same installed bootstrap using npm install bootstrap --save, did jquery , required in app.js

app.js file

var jquery = require('jquery'); var bootstrap = require('bootstrap'); 

changed too

global.jquery = require('jquery'); var bootstrap = require('bootstrap'); 

var jquery = require('jquery'); var bootstrap = require('bootstrap');

but when run debug=nodeaangularmysql:* ./bin/www following errors.

/home/sharif/sites/node/nodeaangularmysql/node_modules/bootstrap/js/transition.js:59 }(jquery);   ^ referenceerror: jquery not defined     @ object.<anonymous> (/home/sharif/sites/node/nodeaangularmysql/node_modules/bootstrap/js/transition.js:59:3)     @ module._compile (module.js:460:26)     @ object.module._extensions..js (module.js:478:10)     @ module.load (module.js:355:32)     @ function.module._load (module.js:310:12)     @ module.require (module.js:365:17)     @ require (module.js:384:17)     @ object.<anonymous> (/home/sharif/sites/node/nodeaangularmysql/node_modules/bootstrap/dist/js/npm.js:2:1)     @ module._compile (module.js:460:26)     @ object.module._extensions..js (module.js:478:10) 

this first time using bootstrap way download , copied in stylesheets folder under public folder or google cdn.

never used before. know few thisn

  1. how use bootstrap using npm install
  2. how use jquery using npm install
  3. and how fix error

any idea?

use below cdn in views file either in hbs or html , below cdn's should work fine.

i struggling same, still trying bootstrap rendered through node, until below cdn's should work fine views, if included.

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet"/>  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>  <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -