简体   繁体   中英

:4200//assets/config.json:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Using VS code angular 14

Project was updated from angular 8

ng build and ng serve works fine.

But http://localhost:4200/ give this error: Failed to load resource: the server responded with a status of 404 (Not Found):4200//assets/config.json:1

And I stuck here.

enter image description here

enter image description here

In the file configuration.service.ts there is this

private get configurationUrl(): string { const path = (environment.configurationPath.startsWith('/')? '': '/') + environment.configurationPath; const baseUrl = this.window.document.baseURI; return ${baseUrl}${path}; }

I changed the first line because it is adding a backslash for I don't know what reason. private get configurationUrl(): string { const path = environment.configurationPath; const baseUrl = this.window.document.baseURI; return ${baseUrl}${path}; } And this solve the issue. So thank you all for your help, it made me think to look for this double backslash

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM