将angular-cli.json中的angular-cli更改端口更改为3000 [英] angular-cli change port to 3000 in angular-cli.json
问题描述
我使用Daniel Zen的Material Todo应用程序,想要更改为angular-cli.json中的port. https://github.com/danielzen/material-todo
i use the material todo app from Daniel Zen and want to change to port in the angular-cli.json. https://github.com/danielzen/material-todo
但这不起作用. 我试过了:
But this doesn't work. I tried this:
{
"port" : 3000,
但是什么也没发生. 有人有主意吗?
But nothing happens. Anyone an idea?
推荐答案
使用Angular-CLI 1.0.0编辑
您现在可以通过定义如下属性直接在.angular-cli.json
文件中定义使用的端口:
You can now directly define the used port in the .angular-cli.json
file by defining the property like this:
{
"defaults": {
"serve": {
"port": 2500
}
}
}
这里是指向配置的所有可用选项的直接链接: Angular-CLI选项配置
Here is a direct link to all available options for the configuration: Angular-CLI options configuration
旧答案
您可以直接在packages.json
中对其进行配置,并通过以下方式更改start
脚本:
You can configure it directly in your packages.json
, change your start
scripts by:
"start": "ng serve --port 2500",
然后使用npm start
这篇关于将angular-cli.json中的angular-cli更改端口更改为3000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!