简体   繁体   English

如何更改Angular快速入门中的默认Lite服务器端口?

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

I just downloaded Angular 4 quickstart app and attempted to change the default lite-server port by adding "port": 8000 to bs-config.json as following: 我刚刚下载了Angular 4快速入门应用程序,并尝试通过将"port": 8000添加到bs-config.json来更改默认的lite-server端口,如下所示:

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

When I npm start the app I see that bs-config.json is read OK, but lite-server still continues with the default port 3000 当我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...

What am I missing? 我想念什么?

Based on the documentation , you should declare a port as a top level: 根据文档 ,您应该将端口声明为顶层:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM