2016-06-21 37 views
1

嘗試使用npm和grunt設置頁面時出現錯誤。爲什麼這個GET請求找不到我的腳本?

Request URL:http://localhost:9997/bower_components/requirejs/require.js 
Request Method:GET 
Status Code:404 Not Found 

它有這樣一種與外表麻煩HTML:

<script> 
      var require = { 
       baseUrl: '/', 
       paths: { 
        'underscore': '/bower_components/underscore/underscore', 
        'backbone': '/bower_components/backbone/backbone', 
        'jquery': '/bower_components/jquery/dist/jquery', 
        'react': '/bower_components/react/react', 
        'mustache': '/bower_components/mustache/mustache', 
        'mySite-assets': '.' 
       } 
      }; 
     </script> 

//Specifically this next line: 
     <script src="/bower_components/requirejs/require.js"></script> 

我做的HTML的文件進行任何更改,只要我跑咕嚕恢復。我在所有的html文件中都有這個問題。我有一個非常大的項目,我無法弄清楚要更改哪個配置文件來解決這個問題。

+1

這是什麼都與Node.js的呢? – peteb

+0

沒有線索。它被建議作爲標籤,我正在使用它,所以我只是認爲它是適當的。不是嗎? – Victoria

+0

我沒有看到上面的任何node.js代碼(服務器端的JavaScript),你應該刪除標籤,所以它不會顯示在node.js標籤隊列 – peteb

回答

1

謝謝你的幫助@topheman!

我在找所有錯誤的地方。 grunt腳本中/ bower_components的路徑不正確。設置正確的路徑後,我所有的HTML腳本現在都沒有這個錯誤。

只是改變了錯誤的路徑這一行:

cwd: 'public/components', 

進入這一行用正確的路徑:

cwd: 'bower_components', 
相關問題