Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在Angular quickstart中更改默认lite服务器端口?_Node.js_Angular_Lite Server - Fatal编程技术网

Node.js 如何在Angular quickstart中更改默认lite服务器端口?

Node.js 如何在Angular quickstart中更改默认lite服务器端口?,node.js,angular,lite-server,Node.js,Angular,Lite Server,我刚刚下载了Angular 4 quickstart应用程序,并尝试通过将“端口”:8000添加到bs config.json来更改默认lite服务器端口,如下所示: { "server": { "port": 8000, "baseDir": "src", "routes": { "/node_modules": "node_modules" } } } 当我npm启动应用程序时,我看到bs config.json读取正常,但是lite服务

我刚刚下载了Angular 4 quickstart应用程序,并尝试通过将
“端口”:8000
添加到
bs config.json
来更改默认lite服务器端口,如下所示:

{
  "server": {
    "port": 8000,
    "baseDir": "src",
    "routes": {
      "/node_modules": "node_modules"
    }
  }
}
当我
npm启动
应用程序时,我看到
bs config.json
读取正常,但是
lite服务器
仍然使用默认端口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"
    }
  }
}
基于,您应该将端口声明为顶级:

{
  "port": 8000,
  "server": {
    "baseDir": "src",
    "routes": {
      "/node_modules": "node_modules"
    }
  }
}
看看这个答案:看看这个答案: