2015-09-26 21 views
1

我試圖使用憲章與sails.js和我收到說沒有定義上Sails.Js

憲章錯誤]

我的代碼使用憲章m跑是

<%new Chartist.Line('.ct-chart', { 
 
    labels: [1, 2, 3, 4, 5, 6, 7, 8], 
 
    series: [ 
 
    [5, 9, 7, 8, 5, 3, 5, 4] 
 
    ] 
 
}, { 
 
    low: 0, 
 
    showArea: true 
 
}); 
 
%>

我不知道爲什麼會這樣,但我已經通過命令安裝憲章

NPM安裝憲章

謝謝您的時間,我希望我很快得到一些答案。

+0

對於aditional的信息,這裏的鏈接chartist.js網站 [鏈接](https:// gionku nz.github.io/chartist-js/index.html) –

回答

0

您正試圖訪問瀏覽器中的npm已安裝模塊。您可以按照這篇文章來做到這一點。

http://dontkry.com/posts/code/using-npm-on-the-client-side.html

我寧願去無論是涼亭或CDN,而不是NPM。

鮑爾:

涼亭安裝圖表專家--save

CDN:

<script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script> <link href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" rel="stylesheet" type="text/css" />

+0

試圖安裝涼亭,以便我可以安裝使用涼亭charters ....它給了我幾個錯誤:c 我現在嘗試CDN方法 @帕普山Maganti嘗試這種代碼: 'code'

它沒有工作......我得到一個空白的地方 –