user2564121
user2564121

Reputation: 115

Deploy angular universal on IIS 10

I am trying to deploy angular universal on IIS 10, I followed this article https://www.thecodehubs.com/how-to-deploy-ssr-angular-universal-to-iis/
This is my Web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="iisnode" path="main.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="DynamicContent">
          <match url="/*" />
          <action type="Rewrite" url="main.js"/>
        </rule>
        <rule name="StaticContent" stopProcessing="true">
          <match url="([\S]+[.](jpg|jpeg|gif|css|png|js|ts|cscc|less|ico|html|map|svg))" />
          <action type="None" />
        </rule>
      </rules>
    </rewrite>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" />
      <remove fileExtension=".svg" />
      <remove fileExtension=".eot" />
      <remove fileExtension=".ttf" />
      <remove fileExtension=".woff" />
      <remove fileExtension=".woff2" />
      <remove fileExtension=".otf" />
      <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml"  />
      <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
      <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
      <mimeMap fileExtension=".woff2" mimeType="application/x-woff" />
      <mimeMap fileExtension=".otf" mimeType="application/otf" />
    </staticContent>
  </system.webServer>
</configuration>

This is my app folder on IIS

enter image description here

But when i start my website on IIS, I got this error

The iisnode module is unable to start the node.exe process. Make sure the node.exe executable is available at the location specified in the system.webServer/iisnode/@nodeProcessCommandLine element of web.config. By default node.exe is expected in one of the directories listed in the PATH environment variable.

So I added this line to my web.config file just before </system.webServer>

<iisnode nodeProcessCommandLine="C:\Program Files\nodejs\node.exe" />
  </system.webServer>
</configuration>

But the same problem still exists. this is my ProgramFiles, here i noticed that the nodejs has shortcut , I am using nvm (node version manager). Is this the reason ?

enter image description here enter image description here

Upvotes: 0

Views: 1646

Answers (1)

ahmed
ahmed

Reputation: 95

Yes you are right, this is because you are using nvm, i faced this issue before.
Switch off node version manager by running in cmd

nvm off

Install node js on your machine, then it will run without any issue.

Upvotes: 1

Related Questions