2013-02-24 111 views
7

我剛安裝並配置了環境以在本地構建Twitter Bootstrap的自定義版本。不好的選擇:'; _;'在構建Twitter引導時

這就是我所做的:

  1. 安裝節點
  2. 安裝NPM
  3. 安裝少
  4. 克隆引導本地
  5. 運行make build編譯引導

第5步:

~/devel/parking/bootstrap$ make build 
jshint js/*.js --config js/.jshintrc 

js/bootstrap-affix.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-alert.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-button.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-carousel.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-collapse.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-dropdown.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-modal.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-popover.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-scrollspy.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-tab.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-tooltip.js: line 24, col 17, Bad option: ';_;'. 
js/bootstrap-transition.js: line 23, col 17, Bad option: ';_;'. 
js/bootstrap-typeahead.js: line 23, col 17, Bad option: ';_;'. 

13 errors 
make: *** [test] Error 2 

第23行:

"use strict"; // jshint ;_; 

我是能夠解決從線23雖然移除// jshint ;_;的問題,我寧願離開引導源不變。

我該如何擺脫這些錯誤以及「錯誤選項」錯誤的含義是什麼?


JS/.jshintrc:

{ 
    "validthis": true, 
    "laxcomma" : true, 
    "laxbreak" : true, 
    "browser" : true, 
    "eqnull" : true, 
    "debug" : true, 
    "devel" : true, 
    "boss"  : true, 
    "expr"  : true, 
    "asi"  : true 
} 

回答

4

我剛纔遇到了同樣的錯誤,搜索引導問題後,

我找到了解決辦法,請看看這些: https://github.com/twitter/bootstrap/pull/5244 https://github.com/twitter/bootstrap/issues/7043

+0

謝謝。我使用[這個拉請求]中引用的[Makefile](https://raw.github.com/ahockersten/bootstrap/10e8efe3cfa1c839abe71bc0cd45076a095d2a09/Makefile)(https://github.com/twitter/bootstrap/pull/7022/files )。我還更改了'BIN_PREFIX'值來反映我的路徑,但問題仍然存在。 – Paolo 2013-02-24 18:22:54

+2

你可以在你的答案中提供該鏈接的一些細節嗎?鏈接只有在鏈接消失時纔有用。 – slm 2013-02-24 18:24:10

+1

我不知道爲什麼,但似乎無法使用全局安裝的jshint。我使用此URL的補丁:https://github.com/twitter/bootstrap/pull/5344/files,您的鏈接是針對版本3的。0.在make之前,只需要替換bootstrap文件夾中的Makefile,不要忘記執行'npm install'來在本地安裝依賴項,然後make會成功。 – boilingbit 2013-02-24 18:51:45

17

今天的問題是,JSHint的最新版本與當前的Bootstrap Makefile不兼容,因爲之前的無聲警告現在會引發錯誤。

刪除JSHint npm uninstall jshint然後安裝版本0.9.1 npm install [email protected]。最後運行make並編譯成功。

+4

你還需要正確的版本的uglify:https:/ /groups.google.com/forum/?fromgroups=#!topic/twitter-bootstrap/cFy3J0nhfwM – benoitr 2013-04-02 09:18:24

+3

npm install uglify-js @ 1 – 2013-08-09 18:00:53

3

簡單地卸載JSHint沒有爲我做。以下是我按照this advice所做的。

cd bootstrap 
npm uninstall -g uglify-js jshint recess connect 
npm uninstall uglify-js jshint recess connect 
npm install 
mkdir bin 
cd bin 
ln -s ../node_modules/*/bin/* . ; ln -s hint jshint 
cd .. 
export PATH=$PATH:$PWD/bin 

之後清理只需運行:

make 

或任何其他補救指令。

+0

非常感謝! Bootstrap 3似乎根本沒有makefile :( – Prasanth 2013-09-17 13:06:12

+0

這樣做,最後的引導文件在哪裏?我的意思是編譯後的文件 – 2013-11-04 10:46:44