#Deploy Problems

48 messages · Page 1 of 1 (latest)

orchid zephyr
#

I have configured some github actions which does a npm run build-prod.

In the package.json under scripts is the following:
"build-prod": "ng build --configuration=production"
I have also tried ng build --production, adding "--base-href /Pfad/" and/or "--deploy-url /Pfad/" but without any positive solution.

In the angular.json and configuration is "production", which replaces "environment.ts" with "environment.prod.ts".

Now the error message:

Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Github actions are green
Funny thing is, this workflow worked last week and I only touched it, because the error message appeared... I am happy for every help I can get 🙂 Thanks in advance

neat kayak
#

What version of Angular are you using?
--production is no longer a flag.
And --configuration=production is the default

#

It doesn't look to me like you have a build problem. It looks like you have a server configuration problem. What URL resulted in that MIME type error?

orchid zephyr
#

CLI 14.1.1

#

but I have tried with --configuration=production and there was the same problem

neat kayak
#

i'm saying that ng build --configuration=production and ng build are the same.

#

It doesn't look to me like you have a build problem.
It looks like you have a server configuration problem.
What URL resulted in that MIME type error?

orchid zephyr
#

the base url from the IIS/my-project

#

That should redirect to my login page

#

But all of these things result in the error

neat kayak
#

This is software engineering. Software engineering is about specifics. I am attempting to go through the tier one tech support for diagnosing problems. But if you don't want to do that then I cannot help you. If you wish to proceed, copy the URL and paste it here.

orchid zephyr
#

The problem with it is, that these are company internal I cannot post here. It is not a public URL.
https://urltoserver:8011/projectname is the URL
The project build is in dist/projectname
The web.config has the <action typ="Rewrite" url"/" />

Would that help?

#

And https://urltoserver:8011/projectname results in the MIME type error

neat kayak
#

I don't need to visit the URL. I need a specific something to talk about.

#

Where is the dist/projectname/index.html file?
Is it https://urltoserver:8011/projectname/index.html or https://urltoserver:8011/index.html

orchid zephyr
#

It is under https://urltoserver:8011/projectname/index.html

neat kayak
#

Then you need: "build-prod": "ng build --base-href=projectname" to start with. But that doesn't address the MIME issue.

#

Are you absolutely certain that the URL with that MIME error is https://urltoserver:8011/projectname?

orchid zephyr
#

Yes, I am on that URL right now, and I changed the buildscript to what you said

#

I know, I can't show much...

neat kayak
#

Yes, but that error is associated with a particular request. One that is in a <script src=" So while it might appear on that page, it is because that page has the tag. What is the URL for that error?

orchid zephyr
#

The src says "/projectname/runtime.js", polyfill.js, vendor.js, main.js all under /projectname/

neat kayak
orchid zephyr
#

this is how my dist/projectname looks like. did I forget sth in the buildprocess?

#

The MIME type is already added to the server

neat kayak
#

apparently not. Look at the Network tab of your browser's development tools. Look for that /projectname/runtime.js request. Look at the response headers. Look for the Content-Type. Also look that the response is actually JS and not your index.html fallback.

orchid zephyr
#

So the Content Type is wrong, but how can I see that the response is the runtime.js?

#

But that is how it is configured...

neat kayak
#

one of the other tabs on that request should show you the response body

orchid zephyr
neat kayak
#

it should only only use index.html if the file being requested doesn't actually exist.
I dunno what <action typ="Rewrite" url"/" /> is, but if that is related that doesn't look specific enough. Unless there is more.

orchid zephyr
#

I changed the fallback to index.html and the web.config is exactly like in the link you posted, thanks for that 🙂
is it ng build --base-href=/projectname/
or ng build --base-href=projectname
?

neat kayak
orchid zephyr
#

Don't know, I think I did everything you said...

#

Still does not work, can't really pinpoint the problem

neat kayak
#

If the Content-Type is still text/html you know the problem. If the response is still index.html for runtime.js then you know what the problem is.

#

If you don't show me your real rewrite command then I cannot really help

orchid zephyr
#

That is the web.config

#

With the Rewrite line

neat kayak
#

Since it is a picture I cannot copy and paste the text to make sure you haven't used “fancy quotes“ or something else funny.
Restart your server and turn on debug logging if that is a thing for IIS

orchid zephyr
#

I will have to do that in the morning then... thank you very much for your help for now

#

As I am not the administrator of the IIS and don't know too much about it... don't want to misconfigure anything ^^