node.js应用生成windows service的plugin——winser
from:http://xiaomijsj.blog.163.com/blog/static/89685520135854036206/
针对项目中windows server machine 不断重启的问题,进行了许多方面修正的尝试:
第一是查系统日志,确定了重启的原因是系统自动更新而引起的,所以暂时把系统更新关闭了。然而考虑到未知的不确定因素导致server重启,考虑将node程序做成windows 的默认service。在系统重启的时候server会自动启动。
node.js有一个plugin提供了将node应用build为一个windows server 的功能,它就是winser。
我们简单使用如下:
1.安装winser
$ npm install winser -g
我尝试不加-g,但是使用的时候报错,说找不到命令,所以最后还是安装成为全局的。
2.在node.js应用的package.json中指定应用的名字:
{
"name":"JMarketPlace",
"version":"0.0.1",
"private":true,
"scripts":{
"start":"node app"
},
"dependencies":{
"express":"3.1.0",
"jade":"*"
}
}
3.在console下进入到app.js所在的目录:
$ winser –i
名字为JMarketPlace的服务就build成功了,如果想删除这个服务,用如下的命令:
$ winser –r
更详细的命令如下:
-h, --help output usage information
-V, --version output the version number
-i, --install install the node application as a windows service
-r, --remove remove the windows service for the node application
-x, --stop stop the service before uninstalling
-s, --silent supress any information in the console
-c, --confirmation ask for confirmation before installing/uninstalling
-p, --path [path] path to the node application you want to install as a service [current directory]
homepage for winser:
https://github.com/jfromaniello/winser
node.js应用生成windows service的plugin——winser的更多相关文章
- Windows使用Node.js自动生成Vue.js模版环境部署步骤-----记录
node.js官网下载并安装node 进入node文档目录下,运行cmd 输入 node -v 查看node版本 出现表示安装完成 输入 npm -v 显示npm版本信息 安装cnpm 输入 npm ...
- node.js压缩版 Windows安装
1.下载 下载地址:https://nodejs.org/zh-cn/download/ 选择相应的版本下载 2.解压缩 将文件解压到要安装的位置,并新建两个目录 node-global :npm全局 ...
- Node.js快速生成26个字母
const buf1 = Buffer.allocUnsafe(26); for (let i = 0; i < 26; i++) { // 97 是 'a' 的十进制 ASCII 值. buf ...
- windows中安装node.js和测试
首先下载node.js安装包:下载页面:http://down.keleyi.com/goto/node.js.htm 选择windows msi安装包,根据自己操作系统选择32位或者64位安装包.然 ...
- 用Node.js开发Windows 10物联网应用
(此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 未来10年内,物联网将会如移动互联网这样深入到我们生活的各方各面.所以微软现在对物联网进行了 ...
- PostMan生成的测试报告 工具node.js、步骤、结果
Postman生成测试报告的工具node.js 1.下载并安装: win系统(下载后一直下一步就好了) mac系统 2.配置环境 (1).在命令提示符里面输入npm 检验安装是否成功可以输入命令:n ...
- A chatroom for all! Part 1 - Introduction to Node.js(转发)
项目组用到了 Node.js,发现下面这篇文章不错.转发一下.原文地址:<原文>. ------------------------------------------- A chatro ...
- Node.js入门(含NVM、NPM、NVM的安装)
本文最初发表于博客园,并在GitHub上持续更新前端的系列文章.欢迎在GitHub上关注我,一起入门和进阶前端. 以下是正文. Node.js的介绍 引擎 引擎的特性: JS的内核即引擎.因为引擎有以 ...
- Node.js 介绍
章节 Node.js 介绍 Node.js 入门 Node.js 模块 Node.js HTTP模块 Node.js 文件系统模块 Node.js URL模块 Node.js NPM Node.js ...
随机推荐
- JAVA 利用SimpleDateFormat将String转换为格式化的日期
1. /** * 使用用户格式提取字符串日期 * * @param strDate 日期字符串 * @param pattern 日期格式 * @return */ public static Dat ...
- Google Pagespeed,自动压缩优化JS/CSS/Image
Google Pagespeed,自动压缩优化JS/CSS/Image 浏览: 发布日期:// 分类:技术分享 关键字: Nginx Appache Pagespeed 自动压缩优化JS/CSS/Im ...
- Vue 组件6内联模板
如果子组件有inline-template特性,组件将把它的内容当做模板,而不是把它当做分发内容,这样模板更灵活. <my-component inline-template> <d ...
- Windows.form增删改查
主界面 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;usin ...
- TPM概述
TPM(Trusted Platform Module)安全芯片,是指符合TPM(可信赖平台模块)标准的安全芯片.标准由TCG(可信赖计算组织,Trusted Computing Group)提出,目 ...
- 修改PHP session 默认时间方法
修改三行如下: 1.session.use_cookies把这个的值设置为1,利用cookie来传递sessionid 2.session.cookie_lifetime这个代表SessionID在客 ...
- IDEA 2017破解 license server激活
确保电脑在联网状态,在激活窗口选择license server 填入下面的license server: http://intellij.mandroid.cn/ http://idea.imsxm. ...
- Scrapy爬虫入门系列4抓取豆瓣Top250电影数据
豆瓣有些电影页面需要登录才能查看. 目录 [隐藏] 1 创建工程 2 定义Item 3 编写爬虫(Spider) 4 存储数据 5 配置文件 6 艺搜参考 创建工程 scrapy startproj ...
- Chai.js断言库API中文文档【转载】
基于chai.js官方API文档翻译.仅列出BDD风格的expect/should API.TDD风格的Assert API由于不打算使用,暂时不放,后续可能会更新. BDD expect和shoul ...
- OpenCV学习笔记二十:opencv_ts模块
一,简介: OpenCV测试库,用于单元测试.