Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error running node app in WebMatrix

I installed WebMatrix and followed these instructions to install IIS 7 on my Windows 7 machine.

When I click 'Run' to run my express node app, the browser pops up and tells me

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 to be installed in %ProgramFiles%\nodejs folder on x86 systems and %ProgramFiles(x86)%\nodejs folder on x64 systems.

Here is my web.config:

<configuration>
<system.webServer>

<handlers>
  <!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
  <add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>

<rewrite>
  <rules>
    <!-- Don't interfere with requests for logs -->
    <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
    </rule>

    <!-- Don't interfere with requests for node-inspector debugging -->
    <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
      <match url="^app.js\/debug[\/]?" />
    </rule>

    <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
    <rule name="StaticContent">
      <action type="Rewrite" url="public{REQUEST_URI}" />
    </rule>

    <!-- All other URLs are mapped to the Node.js application entry point -->
    <rule name="DynamicContent">
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
      </conditions>
      <action type="Rewrite" url="app.js" />
    </rule>
  </rules>
</rewrite>

<!-- You can control how Node is hosted within IIS using the following options -->
<!--<iisnode      
      node_env="%node_env%"
      nodeProcessCountPerApplication="1"
      maxConcurrentRequestsPerProcess="1024"
      maxNamedPipeConnectionRetry="3"
      namedPipeConnectionRetryDelay="2000"      
      maxNamedPipeConnectionPoolSize="512"
      maxNamedPipePooledConnectionAge="30000"
      asyncCompletionThreadCount="0"
      initialRequestBufferSize="4096"
      maxRequestBufferSize="65536"
      watchedFiles="*.js"
      uncFileChangesPollingInterval="5000"      
      gracefulShutdownTimeout="60000"
      loggingEnabled="true"
      logDirectoryNameSuffix="logs"
      debuggingEnabled="true"
      debuggerPortRange="5058-6058"
      debuggerPathSegment="debug"
      maxLogFileSizeInKB="128"
      appendToExistingLog="false"
      logFileFlushInterval="5000"
      devErrorsEnabled="true"
      flushResponse="false"      
      enableXFF="false"
      promoteServerVars=""
     />-->

  <iisnode     
    nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;"
    interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" 
  />
</system.webServer>
</configuration>

What is causing this problem, and how do I fix it?

like image 396
Scott Tesler Avatar asked Oct 26 '12 00:10

Scott Tesler


People also ask

How do I run an app in node js?

The usual way to run a Node. js program is to run the globally available node command (once you install Node. js) and pass the name of the file you want to execute. While running the command, make sure you are in the same directory which contains the app.

How do I open a node js project in browser?

js to structure your JavaScript applications on the client side, you can use Browserify to require JavaScript modules from JavaScript running on the browser. Browsers lack the Node. js platform's require/export and module import systems; therefore, Browserify was developed to make it possible to import Node.


1 Answers

with node.js(64-bit), try placing this at the bottom of web.config

<iisnode watchedFiles="*.js;node_modules\*;routes\*.js;views\*.jade" 
nodeProcessCommandLine="\program files\nodejs\node.exe"/>
like image 182
hardik Avatar answered Oct 14 '22 01:10

hardik