LLe*_*ain 29 javascript node.js twitter-bootstrap
我想为我的网站使用bootstrap(使用node.js).但是我有以下错误:
/var/www/node_modules/bootstrap/js/transition.js:59}(jQuery); ^ ReferenceError:未在Object中定义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)at require(module.js:380) :17)at Object.(/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');
Run Code Online (Sandbox Code Playgroud)
在我的主节点中.
我用npm(npm install bootstrap从我的文件夹)安装了bootstrap .我也尝试以相同的方式安装jquery并添加一个var jQuery= require('jquery');但它不起作用.你知道什么是错的吗?我正在启动node.js,我可能会错过一些东西
然后我<link href="../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">在我的HTML网页中使用引用引导程序`
xqw*_*zts 72
要在npm/node中使用jquery插件,需要在需要插件[本例中为bootstrap]之前设置全局jQuery变量:
global.jQuery = require('jquery');
require('bootstrap');
Run Code Online (Sandbox Code Playgroud)
在此更多细节NPM博客帖子
| 归档时间: |
|
| 查看次数: |
27835 次 |
| 最近记录: |