Search code examples
node.jsazure-service-fabric

NodeJS as Guest executable on service fabric


I have to deploy a nodejs application as guest executable on service fabric, I hosted that on SF locally but when I try to push the code to source control, I have to push the node_modules folder along with it, but Visual studio doesn't allows you to do that since the path is too long in node_modules, Is there a way I can deploy without node_modules, I tried npm packages like nexe but none seem to work


Solution

  • So after alot of research and hit/trial what we did was we zipped the node_modules folder and configured the guest executable to unzip the folder on deployment before starting the service. The unzip was done by calling a batch file before service gets started, here is a code snippet from service manifest of the guest executable that runs the batch file before starting the service:

    <SetupEntryPoint>
      <ExeHost>
        <Program>MySetup.bat</Program>
        <WorkingFolder>CodePackage</WorkingFolder>
        <ConsoleRedirection FileRetentionCount="10"/>
      </ExeHost>
    </SetupEntryPoint> 
    

    Another solution can be to do npm install at the same time but we didn't want to go that path.