How to Node.js and How to npm?

Discussion in 'Site Programming, Development and Design' started by jaa17, Feb 6, 2021.

Tags:
  1. Is there anything I need to do to have the (amazing) Node.js running on my website here at Winhost?

    Once that is done, how do I run npm commands and the like?
     
  2. Elshadriel

    Elshadriel Winhost Staff

  3. Is this correct?

    I know how to set up a sub domain. So say I set up

    mynode.mydomain.com

    I want all .js files on this site to be node.js type files, so I do:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <handlers>
    <add name="iisnode" path="*.js" verb="*" modules="iisnode" />
    </handlers>
    </system.webServer>
    </configuration>

    in the web.config file of mynode.mydomain.com (ie in the mynode directory of my main www.mydomain.com).

    Then I want to get stuff off of github into my subdomain mynode.mydomain.com.

    Where and how do I run the 'npm' stuff? What do you mean run it locally?
     
  4. I have tried to delete the above to show how far I have got with that Knowledge Based Artical

    I have created a subdomain nodepeerserver.mydomain.com
    I have checked it works ok.

    I have written this in my web.config in my nodepeerserver directory of my main site (ie the root directory of the subdomain)

    <?xml version="1.0"?>
    <configuration>

    <system.webServer>
    <!-- This is needed for Node.js -->
    <handlers>
    <add name="ztest" path="ztest.js" verb="*" modules="iisnode" />
    <add name="iisnode" path="*.js" verb="*" modules="iisnode" />
    </handlers>
    </system.webServer>
    </configuration>

    I have downloaded the ztest.js file and put it in my nodepeerserver directory (ie the root of the subdomain)

    I have written nodepeerserver.mydomain.com/ztest.js into the url of my browser

    I receive the following code:

    iisnode encountered an error when processing the request.

    HRESULT: 0x2
    HTTP status: 500
    HTTP reason: Internal Server Error

    Note, I have not done a 'Custom node.js Version' part of the Knowledge Base, as I am content for Winhost to keep that up to date.
     
  5. It does not even work if I put

    <system.webServer>
    <!-- This is needed for Node.js -->
    <handlers>
    <add name="ztest" path="ztest.js" verb="*" modules="iisnode" />
    <add name="iisnode" path="*.js" verb="*" modules="iisnode" />
    </handlers>
    </system.webServer>

    in my main website web.config file at www.mydomain.com (ie not the subdomain) .
    Then, when I have ztest.js in the root directory I get the same error when I type www.mydomain.com/ztest.js in the url.

    So its a node.js issue on my site I think.
     
    Last edited: Feb 7, 2021
  6. I have put this in a support ticket.
    The initial problem I had where ACL permissions were reset to read only by web deploy has been resolved.
    However, I still get the following error which is still open in the support ticket.
    (Note I get this error whether I do this in the subdomain or in the main root directory.)


    iisnode encountered an error when processing the request.

    HRESULT: 0x2

    HTTP status: 500

    HTTP reason: Internal Server Error

    You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

    In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

    The last 64k of the output generated by the node.exe process to stderr is shown below:

    Application has thrown an uncaught exception and is terminated:

    Error: EPERM: operation not permitted, lstat 'E:\web'

    at Object.realpathSync (fs.js:1728:7)

    at toRealPath (internal/modules/cjs/loader.js:344:13)

    at Function.Module._findPath (internal/modules/cjs/loader.js:487:24)

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)

    at Function.Module._load (internal/modules/cjs/loader.js:725:27)

    at Module.require (internal/modules/cjs/loader.js:952:19)

    at require (internal/modules/cjs/helpers.js:88:18)

    at Object.<anonymous> (C:\Program Files (x86)\iisnode\interceptor.js:211:1)

    at Module._compile (internal/modules/cjs/loader.js:1063:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
     
  7. The great team at Winhost Support sorted the problem out really fast. It was a server side issue with the particular server I was on which they sorted within seconds once the problem was established.

    So thanks to all those who helped here on this forum and thanks to the Winhost Support people.
     

Share This Page