andruschka / pm2-meteor

Simplest way to deploy, scale and run Meteor Apps with PM2.
https://www.npmjs.com/package/pm2-meteor
162 stars 38 forks source link

Have pm2 installed on host but pm2 deploy fails with "missing pm2" #70

Open ignacy130 opened 6 years ago

ignacy130 commented 6 years ago

Just like in the title. I can run pm2 -v command on server and get 2.7.1 in result. I run pm2-meteor deploy and get missing pm2.

What may be important is that I had to change global npm directory because I cannot have full, sudo rights on server.

Any other ideas?

ignacy130 commented 6 years ago

Sorry, my bad. pm2 seemed to be cached somehow and was not available after closing and opening the session. Can be closed.

EDIT: Unfortunately no. I added global npm path to PATH on FreeBSD and pm2 is available from command line just after opening the session, but pm2-meteor still says missing pm2 while deploying :(

crapthings commented 6 years ago

do you have NVM on server ?

which node
which pm2
ignacy130 commented 6 years ago

Please have a look: /home/ignacy130/.npm-global is my global npm dir

$ which node
/usr/local/bin/node
$ which pm2
/home/ignacy130/.npm-global/bin/pm2
crapthings commented 6 years ago

weird, do u have multiple node versions installed on server ?

maybe nvm or n ?

ignacy130 commented 6 years ago

To be honest I'm pretty new to node etc. :P That's why I look at pm2-meteor ;) I can see n and nvm are two different programs. How can I check which I do have installed or is used?

As far as I know my hosting lets me change node and nvm I use by following commands:

ln -fs /usr/local/bin/node6 ~/bin/node && ln -fs /usr/local/bin/npm6 ~/bin/npm
echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bash_profile && source $HOME/.bash_profile
crapthings commented 6 years ago
/home/cube/.nvm/versions/node/v4.7.3/lib/node_modules/pm2

we use nvm on our server, u can see npm i -g pm2 will install pm2 into above folder

and our config has nvm.bin field that told which node to use.

what is your config look like?

you can open two terminal

  1. pm2-meteor deploy

  2. pm2-meteor logs maybe the logs will have the clue about wrong npm global path

ignacy130 commented 6 years ago

pm2-meteor logs fails with ERROR: bash: pm2: command not found message :P

I installed nvm on host and provided node version and path to nvm in pm2-meteor.json. No missing pm2 error so far!

"nvm": {
     "bin": "~/.nvm/nvm.sh",
     "use": "4.8.2"
  },
crapthings commented 6 years ago

yeah @ignacy130

but nvm.use still does nothing currently

after uncomment nvm.use and put some log with cmdString, we can ensure it did use correctly version of global pm2 module

the keys is no matter where pm2 bin is, different pm2 version use same profile to start node the node is always nvm alias default one, wish we can use different node version soon.

THPubs commented 6 years ago

Having the same issue. I have both nvm and pm2 setup in my host. But it says ERROR: Please make sure you have node, npm and pm2 installed on your remote machine!. My host already has the project I'm trying to deploy. I deployed it several months ago and it worked fine back then. It's still running. But now I can't re-deploy to the same server. Any idea what's happening?

THPubs commented 6 years ago

The pm2-meteor 0.5.6 version works but it gives me node-gyp fibres error https://github.com/andruschka/pm2-meteor/issues/53

oskarszoon commented 6 years ago

Same issue for me. Using NVM and pm2-meteor commands suddenly failing after 0.9.0, went back to 0.5.6 which works perfectly. It seems "nvm" support was removed from the configs in 0.9.0, couldn't get the "interpreter" config to work, it can't find pm2.

Dailyscat commented 5 years ago

I went through the same issue. It's a nasty bug.

@oskarszoon I am heartily grateful to you.

andruschka commented 5 years ago

Yes guys I am very sorry. I did not have any spare time left since working on 3+ projects. I had a lot of trouble with nvm + pm2-meteor and I had to stop using nvm since there were several bugs / errors... I will look into it soon and try to solve this whole nvm stuff :-(