簡體   English   中英

如何更改Angular快速入門中的默認Lite服務器端口?

[英]How do I change the the default lite-server port in Angular quickstart?

我剛剛下載了Angular 4快速入門應用程序,並嘗試通過將"port": 8000添加到bs-config.json來更改默認的lite-server端口,如下所示:

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

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

 >angular-quickstart@1.0.0 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...

我想念什么?

根據文檔 ,您應該將端口聲明為頂層:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM