Meteor deployment on Ubuntu 14.04 via Phusion Passenger: Cannot execute node


#1

Hello all,

I am encountering a “Cannot execute node: No such file or directory (2)” after deployment.

I followed this deployment tutorial https://goo.gl/ge2DZX. The tutorial does not include creating an empty “public” directory inside the bundled app directory, so I created it since the passenger conf in the tutorial says to point it into a public folder e.g /var/www/todoapp/bundle/public.

Here is my /etc/nginx/sites-enabled/todoapp.conf

`server {
listen 80;
server_name todoapp.mydomain.com;

# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/todoapp/bundle/public;

# Turn on Passenger
passenger_enabled on;

passenger_friendly_error_pages on;

passenger_user arvi;

# Tell Passenger that your app is a Meteor app
passenger_app_type node;
passenger_startup_file main.js;

# Tell your app where MongoDB is
passenger_env_var MONGO_URL mongodb://localhost:27017/meteor;
# Tell your app what its root URL is
passenger_env_var ROOT_URL http://todoapp.mydomain.com;

}`

What I did:

  1. check node: ‘which node’
    ----> output: /usr/local/bin/node
  2. check node version: ‘node -v’
    ----> output: v0.12.2
  3. check path: ‘echo $PATH’
    ----> output: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  4. double check node: node
    ----> output: > (CTRL + C’d two times to quit)
  5. start/stop nginx - same error
  6. update node: ‘nvm install 4.4.1’ then ‘nvm use 4.4.1’
  7. check node: ‘which node’
    ----> output: /home/arvi/.nvm/versions/node/v4.4.1/bin/node
  8. check path: ‘echo $PATH’
    ----> output:
    /home/arvi/.nvm/versions/node/v4.4.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
  9. start/stop nginx - same error

Machine: Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-48-generic x86_64)

I’ve been stuck for more than 4 hours already trying to figure out why it can’t execute node. I can’t find related articles so I decided to seek help already. :slight_smile:

Thank you so much.


#2

Finally resolved issues in deploying meteor via Phusion Passenger:

The existing tutorial for Meteor Phusion Passenger deployment as of 03/30/2016 lacks important details:

The node version to be used must be 0.10.40 (any version higher than that, I tried 0.12.2 and 4.4.1 will result to Cannot execute node error as seen in my screenshot above).

nvm use 0.10.40

(assuming you have nvm installed)

You must add your node path in /etc/nginx/nginx.conf

in my case:
passenger_nodejs /home/arvi/.nvm/v0.10.40/bin/node;

You can check your path via which node

Make sure that your node path is appended in PATH env variable via
echo $PATH

After solving the node issue, another error about ‘missing fibers’ will appear.

Go to your project directory e.g /var/www/todoapp/bundle/programs/server and use a 1.0.1 version of fibers:

npm uninstall fibers
npm install fibers@1.0.1

After solving that fiber issue, you might also encounter an bcrypt invalid elf header like in my case
Go to your project directory e.g /var/www/todoapp/bundle/programs/server

npm install bcrypt

cp -r /var/www/todoapp/bundle/programs/server/node_modules/bcrypt /var/www/todoapp/bundle/programs/server/npm/npm-bcrypt/node_modules/

When deploying updates, upon unpacking new bundle, make sure to review node version and list of packages to prevent encountering npm packages errors:

  1. nvm use 0.10.40

Make sure we’re in bundle/programs/server folder at this point before running the command
2. npm install --production
3. npm prune --production
4. npm install fibers@1.0.1
5. npm install bcrypt

cp -r /var/www/todoapp/bundle/programs/server/node_modules/bcrypt  /var/www/todoapp/bundle/programs/server/npm/npm-bcrypt/node_modules/

Then finally, restart passenger:
passenger-config restart-app /var/www/todoapp/bundle

Thanks to various sources:


https://groups.google.com/forum/#!msg/phusion-passenger/Cxut-9pwa4M/yfWq_81ajzkJ

https://tagrudev.com/blog/setting-up-meteor-with-nginx-and-passenger-on-ubuntu-1404


Meteor Build, Meteor Up, MupX -- Can you make it more confusing?
#3

@arvi Have you encountered this problem?

W: Failed to fetch https://oss-binaries.phusionpassenger.com/apt/passenger/dists/trusty/main/binary-amd64/Pac kages gnutls_handshake() failed: A TLS packet with unexpected length was received.

I am stuck here.


#4

Hello Sir Ralph :smile: Nice to see you here.

Nope, I didn’t encounter that error (deployed via DIgitalOcean Ubuntu 14.04).

You might want to take a look at these:

As of July 10, I am not encountering errors I previously encountered and no need to do the workaround as mentioned above. I was able to deploy new meteor project last night easily. :smile:

https://www.phusionpassenger.com/library/walkthroughs/deploy/meteor/ownserver/nginx/oss/trusty/deploy_app.html