Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does PM2 work on Windows? #51

Open
sproleee opened this issue Jan 20, 2017 · 4 comments
Open

Does PM2 work on Windows? #51

sproleee opened this issue Jan 20, 2017 · 4 comments

Comments

@sproleee
Copy link

sproleee commented Jan 20, 2017

I ask because everything was going smoothly until the end of employment with the following error (Windows dev PC and Ubuntu DO droplet host):

Command failed: C:\WINDOWS\system32\cmd.exe /s /c "cd C:\Users\ayy\meteorProject\.deploy && tar -zcvf bundle.tar.gz bundle pm2-env.json"
'tar' is not recognized as an internal or external command,
operable program or batch file.

It appears that my computer can't read tar files and there is no solution for this as far as I know. There are programs that allow you to manually unbundle the tar files, but not sure if something for command line is available.

@lmachens
Copy link

lmachens commented May 6, 2017

This is a little bit hacky but you could add two batch scripts in the folder (tar.bat and rm.bat) with the following content:

rm.bat

@echo off

rd /s /q bundle 2>nul
del pm2-env.json 2>nul
del bundle.tar.gz 2>nul
rd git-src 2>nul
echo 1

To make this temporary solution easier -> clean up everything.

tar.bat

echo off
set arg1=%1
set arg2=%2
"C:\Program Files\7-Zip\7z" -ttar a dummy bundle -so | "C:\Program Files\7-Zip\7z" -si -tgzip a bundle.tar.gz

You need to install 7-Zip which can create tar.gz files.

@lmachens
Copy link

lmachens commented May 6, 2017

You will have more problems if you use m2-meteor stop. So this is just an idea how to make it work on Windows.

@andruschka
Copy link
Owner

Sorry but currently ony unix OS are supported.
I don't have a windows computer so if some one wants to fork - I will appreciate it!

@michbak
Copy link

michbak commented Nov 16, 2018

It is almost working. The problem is with remote paths. They are generated with backslashes and if you are deploying for linux/unix/macOS then it will fail of course.

Unfortunately I don't have time to learn CoffeeScript at the moment, so here is the recipe. Someone please translate it back to CoffeeScript.

  fixRemotePath = function(pm2mConf, path) {
    if (pm2mConf.meteorBuildFlags.match(/os\.windows/))
      return path.replace(/\//g, '\\');
    else
      return path.replace(/\\/g, '/');
  };

  joinRemotePath = function(pm2mConf, ...paths) {
    return fixRemotePath(pm2mConf, path.join(...paths));
  };

Now instead path.join(...) call joinRemotePath(pm2mConf, ...). The fix need to be applied to remoteTasks.coffee (many places, but not all!) and to localTasks.coffee, where appJson.script is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants