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:
相关文章
- JS框架_(JQuery.js)网页文字评论弹幕
- JS框架_(JQuery.js)文章全屏动画切换
- JS框架_(JQuery.js)图片相册掀开切换效果
- JS框架_(Bootstrap.js)实现简单的轮播图
- 一统江湖的大前端(1)——PPT制作库impress.js(含附件)
- JS - 解决引入 js 文件无效的问题
- A2D JS框架 - DES加密解密 与 Cookie的封装(C#与js互相加密解密)
- 使用grunt合并压缩js、css文件
- [Node.js] Pass command line arguments to node.js
- [Whole Web, Node.js, PM2] Restarting your node.js app on code change using pm2
- [Node.js] Using npm link to use node modules that are "in progress"
- [Node.js] Add node.js command line to global
- [Node.js] Mock an API for Local Development in React with Mirage JS
- [Node.js] Using npm link to use node modules that are "in progress"
- 让Visual Studio 也支持JS代码折叠 —— 续 [ Visual Studio | Js | ScriptOutline | SmallOutline ]
- [FE] nvm-windows: Microsoft/NPM/Google 推荐 Windows 的 Node.js 版本管理器
- windows 环境下使用 Node.js 访问 SAP OData 遇到 unable to get local issuer certificate
- Atitit stomp.js conn连接activemq 目录 1.1. activemq 启动,已经默认开启了stomp ws的接口。。地址是1 1.2. Js 客户端代码1 1.3
- windows server 2008 安装Microsoft ActiveSync 6.1提示缺少一个Windows Mobile设备中心所须要的Windows组件
- js递归生成树形结构(filter)
- JS:使用Mock.js生成随机数据,拦截 Ajax 请求
- chromium在windows上的编译 构建 Checking out and Building Chromium for Windows
- Node.js(一)概述、全局对象/函数、node各模块使用介绍
- 【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03
- 【JS高级】js之正则相关函数以及正则对象_02
- js点击删除当前demo示例(整理)
- Windows安装WSL进行机器学习(windows和Ubuntu同时使用)