2013-07-20 18 views
1

我在我的項目安裝砌築3.0,但有一些錯誤:如何使用與要求砌築3.0和亭子

GET http://localhost:3000/get-style-property/get-style-property.js 404 (Not Found) require.js:1880 
Uncaught Error: Script error for: get-style-property/get-style-property 
http://requirejs.org/docs/errors.html#scripterror require.js:163 
GET http://localhost:3000/get-size.js 404 (Not Found) require.js:1880 
Uncaught Error: Script error for: get-size 
http://requirejs.org/docs/errors.html#scripterror require.js:163 
GET http://localhost:3000/.js 404 (Not Found) require.js:1880 
Uncaught Error: Script error for: 
http://requirejs.org/docs/errors.html#scripterror require.js:163 

工作:

mac 10 
bower 0.10 
node 0.10.8 

我bower.json:

{ 
    "name": "kethervideo", 
    "version": "0.0.1", 
    "dependencies": { 
    "jquery": "~2.0.3", 
    "requirejs": "~2.1.5", 
    "underscore": "~1.4.4", 
    "masonry": "~3.0.3", 
    "imagesloaded": "~3.0.1" 
    } 
} 

我的requirejs配置:

requirejs.config({ 
    paths: { 
     jquery: 'bower_components/jquery/jquery' 
     , underscore: 'bower_components/underscore/underscore' 
     , eventEmitter: 'bower_components/eventEmitter/EventEmitter' 
     , eventie: 'bower_components/eventie/eventie' 
     , getSize: 'bower_components/get-size/get-size' 
     , getStyleProperty: 'bower_components/get-style-property/get-style-property' 
     , outlayerItem: 'bower_components/outlayerAmd/item' 
     , outlayer: 'bower_components/outlayerAmd/outlayer' 
     , masonry: 'bower_components/masonry/masonry' 
     , imagesloaded: 'bower_components/imagesloaded/imagesloaded' 

    } 
    , shim:{ 
     "underscore": ["jquery"] 
     , "masonry": ["jquery"] 
     , "imagesloaded": ["jquery"] 
    } 
}); 

我不知道它有什麼問題,我包括砌體需要的所有軟件包。

回答

0

您正在使用camelCase路徑,它似乎在這種情況下是用破折號。嘗試一下,它應該工作。

0

問題是路徑中鍵的名稱。

如果您檢查getSize.js的底部,你會發現它

define([ 'get-style-property/get-style-property' ], defineGetSize); 

它會檢查配置的別名,如果不能找到一個,那麼它會檢查的相對路徑;這就是爲什麼你得到404錯誤

改變你的配置,以類似下面應該可以解決404錯誤

requirejs.config({ 
    paths: { 
     jquery: 'bower_components/jquery/jquery' 
     , underscore: 'bower_components/underscore/underscore' 
     , eventEmitter: 'bower_components/eventEmitter/EventEmitter' 
     , eventie: 'bower_components/eventie/eventie' 
     , 'get-size/get-size': 'bower_components/get-size/get-size' 
     , 'get-style-property/get-style-property': 'bower_components/get-style-property/get-style-property' 
     , outlayerItem: 'bower_components/outlayerAmd/item' 
     , outlayer: 'bower_components/outlayerAmd/outlayer' 
     , masonry: 'bower_components/masonry/masonry' 
     , imagesloaded: 'bower_components/imagesloaded/imagesloaded' 

    } 
    , shim:{ 
     "underscore": ["jquery"] 
     , "masonry": ["jquery"] 
     , "imagesloaded": ["jquery"] 
    } 
}); 
0

坐落在.bowercc文件的目錄路徑爲「應用程序/腳本」,並做a 涼亭安裝

+0

歡迎SO。由於這是您的第一篇文章,請考慮添加一些鏈接,其中OP可以參考提出的步驟。 – dic19

1

除了其他人的建議,我不確定砌體是requirejs 3.1版之前準備好。
在這裏看到:https://github.com/desandro/masonry/issues/296#issuecomment-21685501

在3.1版本,你可以按照從這裏的說明:

http://masonry.desandro.com/appendix.html

requirejs.config({ 
    paths: { 
    eventie: 'bower_components/eventie', 
    'doc-ready': 'bower_components/doc-ready', 
    eventEmitter: 'bower_components/eventEmitter', 
    'get-style-property': 'bower_components/get-style-property', 
    'get-size': 'bower_components/get-size', 
    'matches-selector': 'bower_components/matches-selector', 
    outlayer: 'bower_components/outlayer', 
    masonry: 'bower_components/masonry' 
    } 
}); 

requirejs([ 'masonry/masonry' ], function(Masonry) { 
    new Masonry(/*...*/) 
});