sockjs节点/信息?404(未找到) [英] sockjs-node/info? 404 (Not Found)
问题描述
我已经失去搜索了几个小时,但仍然找不到我想要的东西.基本上,在 Angular 6应用中运行ng serve时,我会在控制台中收到此错误:
I've done lost of search for couple of hours now and still can't find what I'm looking for. Basically I get this error in the console when running ng serve in my Angular 6 app:
GET http://local.mywebsitesecure.com/sockjs-node/info?t=1540568455931 404 (Not Found)
根据我的研究,解决方案可能只是更新
Based on my research the solution could be just updating
webpack.config.js
webpack.config.js
但是,我在项目中找不到webpack.config.js.他们还说要做:
However, I can't find webpack.config.js in my project. They also say to do:
"ng弹出"
创建一个Webpack,但似乎不起作用.
to create a webpack, but it doesn't seem to work.
解决方案:,我可以通过运行此命令使其正常运行(它确实有效!):
SOLUTION: I can get it to work by running this (It actually works!):
ng serve --public-host = http://localhost:4200
但是我希望能够在我的应用程序中的某个地方进行设置,以便我只能这样做
BUT I want to be able to set this up somewhere in my app so that I can only do
ng服务
有人知道如何解决此问题并摆脱此错误( sockjs-node/info ).在此先多谢!
Does anyone know how to fix this issue and gid rid of this error (sockjs-node/info). Thanks a lot in advance!
推荐答案
您可以编辑 angular.json
文件,并为 public-host
添加选项.请注意,所有选项都是驼色的,而不是用烤肉包包裹的.
You can edit your angular.json
file and add the option for public-host
. Mind you all options are camelCased not kebab-cased.
...
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "congiftest:build",
"publicHost":"http://localhost:4200"
},
},
...
这将允许您只运行 ng serve
并添加 public-host
标志.
This will allow you to just run ng serve
and the public-host
flag will be added.
这篇关于sockjs节点/信息?404(未找到)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!