我刚刚结束了Angular 2的教程,我找不到将localhost端口从3000更改为8000的方法.在我的package.json文件中有"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "我认为相关的行,但我不确定.
Kal*_*man 19
您可以bs-config.json在文档中更改它,如文档https://github.com/johnpapa/lite-server#custom-configuration中所述
例如,
{
"port": 8000,
"files": ["./src/**/*.{html,htm,css,js}"],
"server": { "baseDir": "./src" }
}
Run Code Online (Sandbox Code Playgroud)
1->使用文件默认配置 - Angular-cli来自ember-cli项目.要在特定端口上运行应用程序,请在项目根目录中创建.ember-cli文件.在那里添加您的JSON配置:
{"port":1337}
2->使用命令行工具在Angular-Cli中运行此命令
ng serve --port 1234
要永久更改端口号:
去
node_modules /角-CLI /命令/ server.js
搜索var defaultPort = process.env.PORT || 4200;(将4200更改为您想要的任何其他内容).