How to make a executable from a NodeJS+Express app? - node.js

I have a NodeJS + Express app which I'm using as a Print Server.
I should create an executable from this web application.
So far, I added node-windows and node-mac to make my app run as a service or daemon.
Now what I need is, creating Windows Executable or DMG so my users can execute and start to use my app.
There are some projects like nexe (No support for Exe files) and EncloseJS but I couldn't generate a working EXE file.
What should I use for that?

The guide Standalone Express API Binaries with pkg explains how to make standalone express executables.

Related

Making node.js code to a executable file in MacOS

I have a nodejs app app.js which I'm able to execute with help of the command line tool (changing to the direction of the app and executing the command
node app.js
before that the application is installed with npm install). To make it easier in the daily use i would like to make the app executable, both parts, the installation as well as the trigger of the app.
The app is for generating a small report, I already tried it with a script where I saved the command node app.js.
You might use pkg.
This command line interface enables you to package your Node.js project into an executable that can be run even on devices without Node.js installed.

How to make a Nodejs distributable command line application

I'm making a command line application with commander, inquirer and nightwatch as top dependencies. The main purpose of the app is for automation and testing.. Is there any way i can make this distributable instead of publishing it as npm package. I want the same functionality as those cli made with python, where it can be setup, and run on a target machine. is this possible? Thank you
Here are two open source projects (PKG and Nexe) that enable you to package your Node.js project into an executable:
https://github.com/zeit/pkg/blob/master/README.md
Or
https://github.com/nexe/nexe/blob/dev/README.md
You can use either one to make an executable of your project.

How to download Node.js project deployed on Google Cloud

I have deployed the Node.js code on Google Cloud using following command:-
gcloud app deploy
So, How to download Node.js project deployed on Google Cloud.
I'm not sure but if you need Tomcat server then set and deploy node.js application inside by creating a folder and add the dist folder files in it.
npm install --save #google-cloud/storage
At this point in time it is only possible to download your app's source code for Java, Python, PHP and Golang. The instructions are similar for Python, Golang and PHP:
appcfg.py -A [YOUR_PROJECT_ID] -V [YOUR_VERSION_ID] download_app [OUTPUT_DIR]
where:
[YOUR_PROJECT_ID] is your GCP project ID.
[YOUR_VERSION_ID] is the version ID of your application that you want to download.
[OUTPUT_DIR] is the full directory path to where you want your files downloaded.
In Java you use appcfg.sh:
appcfg.sh -A [YOUR_PROJECT_ID] -V [YOUR_VERSION_ID] download_app [OUTPUT_DIR]
See the link above and also the reference for Java and Python, PHP, Golang

npm module 'openurl' not working after deploying chatbot to Azure

I am working on chatbot development using node.js in MS bot framework.
I need to open a webpage during the conversation. I have used openurl npm module which is working successfully in local environment. After deploying to Azure from GitHub repository, the functionality is not working.
Could you please let me know any solution or fix for this?
I am also using other modules like system-sleep but I am facing the same problem. In short, all custom modules installed are not working after deployment to Azure.
var openurl = require('openurl');
var sleep = require('system-sleep');
openurl.open("https:google.com")
sleep(10);
While most modules are simply plain-text JavaScript files, some modules are platform-specific binary images. These modules are compiled at install time, usually by using Python and node-gyp Azure App Service does not support all native modules and might fail at compiling those with very specific prerequisites.
the description is from Using Node.js Modules with Azure applications.
Per my experience, the system-sleep module requires Python and node-gyp while installing.
You can try to install the modules in windows 32 platform on your local environment, and deploy your application to Azure with the node_modules folder which contains the compiled module.
On the other hand, you can leverage Azure App Service Editor to install those libs which are simply plain-text JavaScript files online.

nssm service is downloading but not serving my web pages

I'm deploying my node and express web application using nssm tool.
I've configured and installed my application as a service but when I navigate to
http://localhost:3000 the ./bin/wwww file is being downloaded instead of serving it.
My application is Node and Express. My startup file is app.js. I'm able to launch the application with the commands
npm start
or simply
nodemon
but cannot run the application using nssm. Can anyone help me what am I doing wrong?
I've switched to a different method.
qckwinsvc is simple and easy to use. I pointed the script path to my appdir\bin\www for this to work.

Resources