How best to deploy NodeJS commandline application

39 views
Skip to first unread message

Michael Uman

unread,
Nov 29, 2017, 7:06:57 PM11/29/17
to nodejs
Hello,

I am rather new to the entire NodeJS environment so please be nice...

I have been working with NodeJS, Electron, and a variety of NPM packages for several months now and would like to deploy my simple commandline application to others in my organization. I do not want to publish my code to the NPM repository though and would rather be able to either package the system in a Debian .deb installer or somehow use the Git repo which I store the project in as a source for the installation.

I have tried just using 'npm install -g git+ssh://xxxxxxx' and it worked a couple of times but cannot fathom why it is not working any more. I always use sudo when installing with the '-g' option and often run into 'privilege' errors. When I just clone my project repository and run 'npm install && sudo npm install -g' the installation seems to work but it just creates a symlink to my checked out repository. I do not want this, I want to have the application installed in the system (ie /usr/local/bin).

My project is written in Typescript and I have the development environment working very well (after a lot of wrangling the tsconfig.json, tslint.json, and package.json files. I am transpiling to ES6 and use a few NPM modules (sprintfs-js, commander, clear, colors, and @types for node & color)...

For reference here is my package.json:

{
"name": "hazard-check",
"version": "1.0.0",
"description": "Pipeline hazard checking tool",
"main": "dist/hazard-check.js",
"files": [
"src/",
"dist/"
],
"dependencies": {
"clear": "0.0.1",
"colors": "^1.1.2",
"commander": "^2.11.0",
"sprintf-js": "^1.1.1"
},
"devDependencies": {
"@types/colors": "^1.1.3",
"@types/node": "^8.0.53",
"typescript": "^2.6.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": "./dist/hazard-check.js",
"keywords": [],
"author": "Michael A. Uman",
"license": "ISC"
}

I much appreciate the support from the members of the NodeJS community. I am impressed with the capabilities of Javascript even though I am a long-time C/C++ developer (with some scripting).

If anyone has a pointer how to go about deploying my application via an installer (ie .deb) or somehow using NPM with my git repository I would be very grateful.

Happy Holidays to everyone!

Michael Uman

Michael Uman

unread,
Nov 29, 2017, 7:36:32 PM11/29/17
to nodejs
Hello Everyone,

Sorry for the post. I spent some time and looked into the NPM repo and found the 'node-deb' tool which was developed expressly for the purpose of packaging a NodeJS project into a Debian .deb installer. I have downloaded it, updated my package.json and just created a debian installer for my package. So far I think this satisfies my requirements.

So in case anyone else has this questions please find the 'node-deb' NPM package and download it and read the README documentation. It took me about 10 minutes to get the installer to work.

https://www.npmjs.com/package/node-deb

Thank you,
Michael Uman

Zlatko

unread,
Nov 30, 2017, 9:22:00 AM11/30/17
to nodejs
Hi Michael,

node-deb is one way to distribute that package. But since your users will have to have a node binary on the system anyway, you can still use npm, just publish the app in a private namespace. Name your package with the org scope, e.g. my private packages on npm are scoped to @zladuric, e.g. "name": "@zladuric/my-project". When you have your company organization (or personal account), you can publish like that and only give access to people (or orgs) which you want to.

It's definitely a viable alternative.

Nathan Rajlich

unread,
Dec 1, 2017, 10:39:22 PM12/1/17
to nodejs
pkg could suit your needs!
https://github.com/zeit/pkg

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/7e9b2a07-095d-42ef-8df8-abddb17b896a%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages