【问题标题】:npm how to change port on the servernpm 如何更改服务器上的端口
【发布时间】:2018-02-14 21:26:53
【问题描述】:

我正在使用 npm(节点包管理器)和 Angular2, 我正在尝试更改服务器的端口,但它 不运行,这是我的 bs-config.json:

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

【问题讨论】:

  • 您也可以尝试在不永久更改的情况下像这样运行ng serve --port 8080

标签: node.js angular npm server port


【解决方案1】:

所以,有两个错误: - 您应该声明属性“端口”的优先级高于属性“服务器” - 你少了逗号

试试这个:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-17
    • 2012-07-02
    • 2017-07-09
    • 1970-01-01
    • 1970-01-01
    • 2014-09-05
    • 1970-01-01
    • 2015-06-18
    相关资源
    最近更新 更多