如何使用pm2部署到Windows堆栈

时间:2022-10-15 21:55:00

Environment

  • Development machine: Windows 7
  • 开发机器:Windows 7
  • Deploy target: Windows 2012 r2
  • 部署目标:Windows 2012 r2
  • NodeJS version v7.10.1
  • v7.10.1 NodeJS版本
  • Git git-bash 2.9.2.windows.1
  • Git git-bash 2.9.2.windows.1

I am trying to deploy a NodeJS project using PM2

我正在尝试使用PM2部署NodeJS项目

PM2 deploy

PM2部署

My PM2 ecosystem file

 deploy : {
        production : {
          user : 'myUser',
          host : '10.1.1.16',
          ref  : 'origin/master',
          repo : 'pshakr@bitbucket.org/pjma/adapter.git',
          path : 'C:\\jhu',
          'post-deploy' : 'npm install && pm2 startOrRestart ecosystem.config.js --env production'
        }
      }

I have opened GIT-Bash on my development machine and getting the following error while running config file

我在我的开发机器上打开了GIT-Bash,并在运行配置文件时得到以下错误。

Error

$ pm2 deploy ecosystem.config.js production setup
--> Deploying to staging environment
--> on host 10.1.1.16
  ○ hook pre-setup
ssh: connect to host 10.1.1.16 port 22: Connection refused

  setup paths failed

Deploy failed

Will PM2 allow me to deploy to a Windows server? any pointers on how to resolve that?

1 个解决方案

#1


2  

It looks like you may need to install SSH server on the Windows 2012r2 server

看起来您可能需要在Windows 2012r2服务器上安装SSH服务器

what-is-a-good-ssh-server-to-use-on-windows

what-is-a-good-ssh-server-to-use-on-windows

sshwindows

sshwindows

Not sure if that will resolve the PM2 deploy, but should explain the connection refused on port 22

不确定这是否会解决PM2部署,但应该解释端口22上拒绝的连接

#1


2  

It looks like you may need to install SSH server on the Windows 2012r2 server

看起来您可能需要在Windows 2012r2服务器上安装SSH服务器

what-is-a-good-ssh-server-to-use-on-windows

what-is-a-good-ssh-server-to-use-on-windows

sshwindows

sshwindows

Not sure if that will resolve the PM2 deploy, but should explain the connection refused on port 22

不确定这是否会解决PM2部署,但应该解释端口22上拒绝的连接