'Deploy AdonisJS 5 server on IIS 7

I am trying to deploy AdonisJS 5 on IIS, I am getting the following error on RunningLog folder

./RunningLog

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'C:\Server\htdocs\Adonis\whatsapp\server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

This is my web.config where I am using as arguments : C:\Server\htdocs\Adonis\whatsapp\node_modules\ts-node .\server.ts However I have tried to play around changing between server.ts and server.js Also I have tried to use ts-node to no avail

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\RunningLog\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments="C:\Server\htdocs\Adonis\whatsapp\node_modules\ts-node .\server.ts">
            <environmentVariables>
                <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
                <environmentVariable name="NODE_ENV" value="Production" />
            </environmentVariables>
        </httpPlatform>
  </system.webServer>
</configuration> 

This is my package.json

{
  "name": "hello-world",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "node ace serve --watch",
    "build": "node ace build --production",
    "start": "node --experimental-specifier-resolution=node --loader ts-node/esm /server.ts",
    "lint": "eslint . --ext=.ts",
    "format": "prettier --write ."
  },
  "eslintConfig": {
    "extends": [
      "plugin:adonis/typescriptApp",
      "prettier"
    ],
    "plugins": [
      "prettier"
    ],
    "rules": {
      "prettier/prettier": [
        "error"
      ]
    }
  },
  "eslintIgnore": [
    "build"
  ],
  "prettier": {
    "trailingComma": "es5",
    "semi": false,
    "singleQuote": true,
    "useTabs": false,
    "quoteProps": "consistent",
    "bracketSpacing": true,
    "arrowParens": "always",
    "printWidth": 100
  },
  "devDependencies": {
    "@adonisjs/assembler": "^5.6.2",
    "@japa/preset-adonis": "^1.0.15",
    "@japa/runner": "^2.0.8",
    "adonis-preset-ts": "^2.1.0",
    "eslint": "^8.15.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-adonis": "^2.1.0",
    "eslint-plugin-prettier": "^4.0.0",
    "pino-pretty": "^7.6.1",
    "prettier": "^2.6.2",
    "typescript": "^4.6.4",
    "youch": "^3.2.0",
    "youch-terminal": "^2.1.4"
  },
  "dependencies": {
    "@adonisjs/core": "^5.7.6",
    "@adonisjs/repl": "^3.1.10",
    "fs": "0.0.1-security",
    "proxy-addr": "^2.0.7",
    "qrcode-terminal": "^0.12.0",
    "reflect-metadata": "^0.1.13",
    "source-map-support": "^0.5.21",
    "ts-node": "^10.7.0",
    "whatsapp-web.js": "^1.16.6"
  }
}

This is my tsconfig.json

{
  "extends": "./node_modules/adonis-preset-ts/tsconfig",
  "include": ["**/*"],
  "exclude": ["node_modules", "build"],
  "compilerOptions": {
    "esModuleInterop": true,
    "outDir": "build",
    "rootDir": "./",
    "sourceMap": true,
    "paths": {
      "App/*": ["./app/*"],
      "Config/*": ["./config/*"],
      "Contracts/*": ["./contracts/*"],
      "Database/*": ["./database/*"]
    },
    "types": ["@adonisjs/core", "@adonisjs/repl", "@japa/preset-adonis/build/adonis-typings"]
  },
    "ts-node": {
        "esm": true
    },
    "lib": ["esnext"]
}


Solution 1:[1]

On Windows, I recommend setting to listen on HTTP port 8080 and HTTPS port 8443 to fix this. It really doesn't like using those lower number ports. And you also have IIS installed and running, so there might be some kind of port conflict there as well.

Or you can refer to this link? listen EACCES: permission denied in windows

Hope it can help you a little.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JennyDai