[英]How do I load a file in a parent directory using http-server?
例如/ LIB / D3 / d3.js
例如/ SRC / scatterPlotVersion3 / index.html中
例如/ CSS / styles.css的
http服務器( https://github.com/nodeapps/http-server )
的index.html
<link rel="stylesheet" type="text/css" href="../../css/styles.css"/>
<script type="text/javascript" src="../../lib/d3/d3.js"></script>
進入localhost:8080之后。 我收到以下錯誤:
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (styles.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (d3.js, line 0)
[Error] ReferenceError: Can't find variable: d3 global code (localhost, line 16)
我該如何解決?
我現在看到的解決方案是在父目錄中運行http-server,然后在子目錄中運行服務器訪問文件。
可以說:我有一個src文件夾,並且在里面有具有index.html文件的示例文件夾。 src還包含我想在index.html中使用的abc.js。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.