2017-04-21 107 views
0

我剛剛下載角4快速啓動應用程序,試圖通過增加"port": 8000更改默認的精簡版服務器端口bs-config.json如下:如何更改Angular quickstart中默認的lite-server端口?

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

當我npm start的應用程序,我看到bs-config.json讀OK,但lite-server仍繼續使用默認端口3000

>[email protected] serve /Users/me/code/quickstart 
[1] > lite-server -c=bs-config.json 
[1] 
[1] ** browser-sync config ** 
[1] { injectChanges: false, 
[1] files: [ './**/*.{html,htm,css,js}' ], 
[1] watchOptions: { ignored: 'node_modules' }, 
[1] server: 
[1] { baseDir: 'src', 
[1]  middleware: [ [Function], [Function] ], 
[1]  port: 8000, 
[1]  routes: { '/node_modules': 'node_modules' } } } 
[1] [BS] Access URLs: 
[1] ------------------------------------- 
[1]  Local: http://localhost:3000 
[1]  External: http://192.168.1.12:3000 
[1] ------------------------------------- 
[1]   UI: http://localhost:3001 
[1] UI External: http://192.168.1.12:3001 
[1] ------------------------------------- 
[1] [BS] Serving files from: src 
[1] [BS] Watching files... 

我錯過了什麼?

+1

看看這個答案:http://stackoverflow.com/questions/35516783/how-can-you-specify -ui口換精簡版服務器 – Mazz

回答

3

基於the documentation,你應該聲明端口爲頂層:

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