我在angular 2上工作。项目正在使用"ng-serve or npm-start“命令在本地编译和运行。现在,Teamviewer已连接以访问Safari浏览器。因为localhost:4200没有运行。
如何在Teamviewer浏览器中本地运行项目?我试过了
ng serve --host=localIP
ng serve --host localIP
start http://localhost:4200 & ng serve -port 4200但是什么都不起作用。
我将我的.angular-cli.json改为
"defaults": {
"serve": {
"port": 4200,
"host": "localIP"
},
"styleExt": "css",
"component": {}}
和baseUrl: config.js中的'http://localIP:4200/‘。
那么谁能帮我在teamviewer中本地运行项目的命令是什么?提前谢谢。
发布于 2018-01-05 19:14:18
你可以使用ng serve --host 0.0.0.0让你的服务在你的newtork上可用。
假设您的IP地址为1.2.3.4,其他人将能够通过
http://1.2.3.4:4200/如果它们不在同一个网络上,您将不得不向全世界开放您的端口。
为此,您只需要一个NAT PAT规则
origin: *
port range : 4200 - 4200
IP destination: 1.2.3.4
port destination: 4200不需要teamviewer!
https://stackoverflow.com/questions/48112392
复制相似问题