2017-09-06 258 views
0

我正在使用npm(節點packege管理器),與Angular2, 我試圖改變服務器的端口,但它 不運行,這是我的bs -config.json:npm如何更改服務器端口

{ 
    "server": { 
    "port": 8080 
    "baseDir": "src", 
    "routes": { 
     "/node_modules": "node_modules" 
    } 
    } 
} 
+0

你也可以嘗試不用永久更改而運行像這樣'ng serve --port 8080' –

回答

2

因此,有兩個錯誤: - 你應該優先於屬性「服務器」 較高聲明屬性「端口」 - 你缺少逗號

嘗試這個:

{ 
    // local port 
    "port": 8080, 
    "server": { 
    "baseDir": "src", 
    "routes": { 
     "/node_modules": "node_modules" 
    } 
    } 
}