Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Angular App startup issue on deployed Angular #6466


User avatar
0
abdourahmani created

Hi ! Can some one give me some guidance to correct this issue ? The App runs fines in developpment and crashes when deployed.

I'm using ASP.NET CORE & Angular V.6.0.0.

From IIS I can start the backend and it runs ok.

But when I launch the app from the browser, here is the error I get this error :

main.6b917b420639c862ad7c.js:1 ERROR SyntaxError: Unexpected token < in JSON at position 0

    at JSON.parse (<anonymous>)

    at XMLHttpRequest.o.onreadystatechange [as __zone_symbol__ON_PROPERTYreadystatechange] (main.6b917b420639c862ad7c.js:1)

    at XMLHttpRequest.E (polyfills.c60318e761d83ed91d05.js:1)

    at t.invokeTask (polyfills.c60318e761d83ed91d05.js:1)

    at Object.onInvokeTask (main.6b917b420639c862ad7c.js:1)

    at t.invokeTask (polyfills.c60318e761d83ed91d05.js:1)

    at e.runTask (polyfills.c60318e761d83ed91d05.js:1)

    at e.invokeTask [as invoke] (polyfills.c60318e761d83ed91d05.js:1)

    at m (polyfills.c60318e761d83ed91d05.js:1)

    at XMLHttpRequest.b (polyfills.c60318e761d83ed91d05.js:1)

Appconfig.json :

{
"remoteServiceBaseUrl": "http://localhost:22770",
"appBaseUrl": "http://localhost:4230",
"localeMappings": [
  {
    "from": "pt-BR",
    "to": "pt"
  },
  {
    "from": "zh-CN",
    "to": "zh"
  },
	{
		"from": "he-IL",
		"to": "he"
	}
]
}

appconfig.production.json

  "remoteServiceBaseUrl": "http://localhost:22770",
  "appBaseUrl": "http://localhost:4230",
  "localeMappings": [
    {
      "from": "pt-BR",
      "to": "pt"
    },
    {
      "from": "zh-CN",
      "to": "zh"
    },
	{
		"from": "he-IL",
		"to": "he"
	}
  ]
}

6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    Your appconfig.production.json file json format is incorrect. Missing part at the beginning {

  • User Avatar
    0
    abdourahmani created

    Hi @maliming,

    Sorry the file has this opening { , I just missed it when copying.

    appconfig.production.json

    {
      "remoteServiceBaseUrl": "http://localhost:22770",
      "appBaseUrl": "http://localhost:4230",
      "localeMappings": [
        {
          "from": "pt-BR",
          "to": "pt"
        },
        {
          "from": "zh-CN",
          "to": "zh"
        },
    	{
    		"from": "he-IL",
    		"to": "he"
    	}
      ]
    }
    
  • User Avatar
    0
    ryancyq created
    Support Team

    please share the browser console/network panel with the error as well.

  • User Avatar
    0
    A4amen created

    I also have this same issue with the latest version v8.0 in production. Kindly share the solution please.

  • User Avatar
    0
    maliming created
    Support Team

    hi @A4amen Please create a new question and describe your problem in detail. Thank you

  • User Avatar
    0
    christianharo created

    I also have the same issue as recomended above . I created a new question.