1
首先清除根目录下的.node-gyp
卸载node-gyp模块
npm uninstall node-gyp -g
2
安装环境
npm i -g windows-build-tools
重新安装node-gyp
npm install -g node-gyp
3
设置python版本
npm config set python python
4
安装.net 2.0
5
安装vs 201* c++ 环境
6安装microtime运行时
npm i microtime --save-dev
------------------------
npm uninstall node-gyp -g
npm i -g windows-build-tools
npm install -g node-gyp
npm i -g node-inspector
npm cache clean --force
npm i -g pm2
-------
3.进入下面这个文件夹清除cache
路径:C:UsersPCAppDataRoamingnpm-cache
执行:
npm cache clean --force
----------
借助于pm2-windows-service 可以把pm2以windows服务运行。已服务运行的好处就是,即时用户注销也,pm2也会在后台运行
npm i pm2 -g
npm i pm2-windows-service -g
安装服务:pm2-service-install -n myservice (安装后在windows服务中多了一个myservice的服务)##卸载pm2-service-uninstall
设置环境变量:PM2_SERVICE_SCRIPTS = PM2的配置文件
windows服务中重新启动myservice服务