jQuery not define in bootstrap module
我想对我的网站使用引导程序(与node.js一起使用)。 但是我有以下错误:
/var/www/node_modules/bootstrap/js/transition.js:59
}(jQuery);
^
ReferenceError: jQuery is not defined
at Object. (/var/www/node_modules/bootstrap/js/transition.js:59:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/var/www/node_modules/bootstrap/dist/js/npm.js:2:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
我试图做一个
1 | var bootstrap = require('bootstrap'); |
在我的主节点上。
我使用npm(文件夹中的
然后我在HTML网页中使用
`
要将jquery插件与npm / node一起使用,您需要先设置全局jQuery变量,然后再要求使用插件[在这种情况下为bootstrap]:
1 2 | global.jQuery = require('jquery'); require('bootstrap'); |
此npm博客文章中的更多详细信息