【发布时间】:2015-04-08 05:49:05
【问题描述】:
我想为我的网站使用引导程序(使用 node.js)。但我有以下错误:
/var/www/node_modules/bootstrap/js/transition.js:59 }(jQuery); ^ ReferenceError:未定义 jQuery 在对象。 (/var/www/node_modules/bootstrap/js/transition.js:59:3) 在 Module._compile (module.js:456:26) 在 Object.Module._extensions..js (module.js:474:10) 在 Module.load (module.js:356:32) 在 Function.Module._load (module.js:312:12) 在 Module.require (module.js:364:17) 在需要 (module.js:380:17) 在对象。 (/var/www/node_modules/bootstrap/dist/js/npm.js:2:1) 在 Module._compile (module.js:456:26) 在 Object.Module._extensions..js (module.js:474:10)
我试着做一个
var bootstrap = require('bootstrap');
在我的主节点中。
我用 npm 安装了引导程序(npm install bootstrap 来自我的文件夹)。我还尝试以相同的方式安装 jquery 并添加var jQuery= require('jquery');,但它不起作用。你知道有什么问题吗?我正在启动 node.js,我可能会错过一些东西
然后我在我的 HTML 网页中使用<link href="../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> 来引用引导程序
`
【问题讨论】:
-
你在引导之前加载 jquery 吗?
-
是的,我做了一个
var jQuery = require('jquery');var bootstrap = require('bootstrap');
标签: javascript node.js twitter-bootstrap