Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 脱咖啡因和咖啡化相互作用_Twitter Bootstrap_Bower_Browserify - Fatal编程技术网

Twitter bootstrap 脱咖啡因和咖啡化相互作用

Twitter bootstrap 脱咖啡因和咖啡化相互作用,twitter-bootstrap,bower,browserify,Twitter Bootstrap,Bower,Browserify,当我将debowerify与coffeify一起使用时,出现了bootstrap找不到jquery的问题(浏览器错误): 其中我的source.coffee文件是: $ = jQuery = require ('jquery') require('bootstrap') bootstrap_enabled = (typeof $().modal == 'function') console.log "bootstrap_enabled" console.log bootstrap_enabled

当我将
debowerify
coffeify
一起使用时,出现了
bootstrap
找不到jquery的问题(浏览器错误):

其中我的
source.coffee
文件是:

$ = jQuery = require ('jquery')
require('bootstrap')
bootstrap_enabled = (typeof $().modal == 'function')
console.log "bootstrap_enabled"
console.log bootstrap_enabled
package.json:

{
  "name": "bootstrap_test",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "main": "browserify source.coffee  -t coffeeify -t debowerify  > main.js --debug"
  },
  "bootstrap": {
    "depends": [
      "jquery:$"
    ]
  },
  "dependencies": {},
  "devDependencies": {
    "browserify": "^6.0.2",
    "coffeeify": "^0.7.0",
    "debowerify": "^0.8.2"
  }
}
jquery
bootstrap
通过
bower
安装

但是当我只使用
debowerify
而不使用
coffeify
时,引导程序加载正常:

$ = jQuery = require ('jquery');
require('bootstrap');

browserify source.js -t debowerify > main.js --debug

所以问题在于
debowerify
coffeify
的交互作用。如何解决这个问题?

解决方案是在添加
窗口中添加
。在
jQuery=
之前:

$ = window.jQuery = require ('jquery')
require('bootstrap')
bootstrap_enabled = (typeof $().modal == 'function')
console.log "bootstrap_enabled"
console.log bootstrap_enabled
现在一切正常

$ = window.jQuery = require ('jquery')
require('bootstrap')
bootstrap_enabled = (typeof $().modal == 'function')
console.log "bootstrap_enabled"
console.log bootstrap_enabled