2016-04-21 83 views

回答

0

幾個簡單的方法是使用內置的web服務器,與PHP和Python來。打開一個shell窗口cd到文件所在的文件皆可使用的目錄:

python -m SimpleHTTPServer 

php -S localhost:8000 

然後你可以去http://localhost:8000在您的瀏覽器,那說,如果你看到一個空白屏幕上你可能有錯誤,所以也許檢查開發者控制檯。

0

將其複製並粘貼到一個文件中,並將其命名爲package.json並將其放入項目的根目錄中。然後使用命令行工具導航到項目根目錄,然後輸入npm install 1st安裝軟件包,然後啓動npm。

然後去localhost:8000 p.s.需要安裝節點第一個

{ 
    "name": "npm server", 

    "dependencies": { 
    //your dependencies here 
    }, 
    "devDependencies": { 
    "http-server": "0.9.0" 
    }, 
    "scripts": { 
    "prestart": "npm update", 
    "start": "http-server -a localhost -p 8000" 
    } 
}