1

I have installed a Node.JS + Expres.JS application on my server, with IISNode and Plesk Obsidian. When I surf the page in my browser I get this error:

error

I have already checked the permissions of the respective folders and the respective "App Identities" have the necessary permissions. Every time I start my application, the following error message is written to the log:

1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle lynx@0.0.0~prestart: lynx@0.0.0
6 info lifecycle lynx@0.0.0~start: lynx@0.0.0
7 verbose lifecycle lynx@0.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle lynx@0.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Inetpub\vhosts\kiseni.com\test.kiseni.com\node_modules\.bin;C:\Program Files\nodejs;C:\Program Files (x86)\Mail Enable\BIN;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Mail Enable\BIN64;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Plesk\ctl;C:\Program Files\nodejs\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\.dotnet\tools;C:\Windows\system32\config\systemprofile\AppData\Roaming\npm;C:\Users\kiseniadmin\AppData\Local\Microsoft\WindowsApps
9 verbose lifecycle lynx@0.0.0~start: CWD: C:\Inetpub\vhosts\kiseni.com\test.kiseni.com
10 silly lifecycle lynx@0.0.0~start: Args: [ '/d /s /c', 'node ./bin/www' ]
11 silly lifecycle lynx@0.0.0~start: Returned: code: 1  signal: null
12 info lifecycle lynx@0.0.0~start: Failed to exec start script
13 verbose stack Error: lynx@0.0.0 start: `node ./bin/www`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:223:5)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:223:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid lynx@0.0.0
15 verbose cwd C:\Inetpub\vhosts\kiseni.com\test.kiseni.com
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v12.15.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error lynx@0.0.0 start: `node ./bin/www`
22 error Exit status 1
23 error Failed at the lynx@0.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

The funny part is that after this error the application is available locally on the server at localhost:3000, but outside the application still has the iisnode error from the first screenshot

I am grateful for any help!

Jacob
  • 77,566
  • 24
  • 149
  • 228

1 Answers1

0

The substatus 1002 is IISNODE_ERROR_PIPE_CONNECTION_BEFORE_PROCESS_TERMINATED. This means your process has terminated, so iisnode cannot pipe data to your node process. Your logs confirm that indeed your process is not starting successfully.

You need to figure out why your node process fails to start. Adding some logging to see how far you get before it crashes will help.

Jacob
  • 77,566
  • 24
  • 149
  • 228
  • Maybe something's failing so bad that none of your JavaScript runs at all. It'd be helpful to see what your `package.json` scripts look like so we know exactly what `npm run start` is doing. – Jacob Apr 28 '20 at 19:17
  • Hello, thanks for the answer! I have added my own logging to the start script and there is no error logged here, the necessary modules are loaded and Express is assigned port 3000 - which is open.If I surf the page with localhost:3000 on the server it works without problems:https://i.imgur.com/26McwCV.png. However, I cannot reach the page from the outside and get the error message:https://i.imgur.com/XWaKrVb.png – XIIINITRATE Apr 28 '20 at 19:21
  • Package.json as requested above: `{ "name": "lynx", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "dependencies": { "bcryptjs": "^2.4.3", "cookie-parser": "~1.4.4", "debug": "~2.6.9", "ejs": "~2.6.1", "express": "~4.16.1", "express-session": "^1.17.0", "http-errors": "~1.6.3", "morgan": "~1.9.1", "mysql2": "^2.0.1" } } ` – XIIINITRATE Apr 28 '20 at 19:23
  • My guess is that iisnode is trying to talk to a different process than what you expect. Maybe your script is starting a _new_ process, but the _original_ process has terminated, so iisnode can't communicate with it. See where that error is emitted: https://github.com/tjanczuk/iisnode/blob/c816a6740ae63e2c3065653539ea18b9c5edfce6/src/iisnode/cprotocolbridge.cpp#L671 – Jacob Apr 28 '20 at 19:28
  • You should add your `web.config` to your question so we know how you have it configured. – Jacob Apr 28 '20 at 19:31
  • Also, are you listening on `process.env.PORT`, not port 3000? Post your JS code in case the problem is there. – Jacob Apr 28 '20 at 19:43
  • This is the generated web.config for my subdomain where the app lives or basically shoud live: https://i.imgur.com/yYKWOlX.png. I already tried to add the iisnode specific section as statet in the sample files - but this is throwing the same error – XIIINITRATE Apr 28 '20 at 19:47
  • https://gitlab.com/snippets/1971478 And this is the startup file – XIIINITRATE Apr 28 '20 at 19:49