Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 71 forks source link

ln: XXX/current/source: cannot overwrite directory, windows, git bash #167

Open kimown opened 5 years ago

kimown commented 5 years ago

OS: windows server 2016 SHELL: git-bash

In windows using git-bash , when run ln -sfn source current, will throw error:

image

https://github.com/Unitech/pm2-deploy/blob/master/deploy#L225

UPDATED: I add run "rm -rf $path/current" before line 225 to solve this problem

edorgeville commented 3 years ago

Alternative workaround: pre-deploy: delete pm2 app, delete current folder

// ecosystem.config.js
module.exports = {
  "deploy": {
    "production": {
      "user": "xxxxxx",
      "host": ["xxxxxx"],
      "ref": "xxxxxx",
      "repo": "xxxxx",
      "path": "C:/test",
      "pre-deploy": "pm2 delete ecosystem.config.js && rm -rf C:/test/current",
      "post-deploy": "npm install && pm2 startOrRestart ecosystem.config.js"
    }
  }
}