Application installation on a private server

I am struggling to push my application to a production environment. The development and production machine is the same, but I use different accounts. These are my steps:

On development account:

  1. npm version 4.5.0, node version v7.7.3, Meteor version 1.4.4.2
  2. run meteor build to produce the application bundle

On production account:

  1. start with a clean file tree structure (no directories like .meteor, .nodes , .node-gyp, .npm)
  2. Create directories mkdir -p ~/.nodes && cd ~/.nodes
  3. download the latest version of nodejs: curl -O http://nodejs.org/dist/latest/node-v7.10.0-linux-x86.tar.xz
  4. Unpack it: tar xf node-v7.10.0-linux-x86.tar.xz
  5. Remove the original file: rm node-v7.10.0-linux-x86.tar.xz
  6. Create a link ln -s node-v7.10.0-linux-x86 current
  7. Use the installed binaries: export PATH="~/.nodes/current/bin:$PATH"
  8. npm version 4.2.0; node version v7.10.0 (from ~/.nodes/current/bin/node)
  9. Go to home directory, extract the bundle, change directory cd ~ && tar xf … && cd bundle
  10. The README file instructs me to execute (cd programs/server && npm install)

And this is what I get:

meteor-dev-bundle@0.0.0 install /home/az/cdb/bundle/programs/server
node npm-rebuild.js

npm WARN lifecycle npm is using /usr/bin/node but there is no node binary in the current PATH. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

bcrypt@1.0.2 install /home/az/cdb/bundle/programs/server/npm/node_modules/bcrypt
node-pre-gyp install --fallback-to-build

npm ERR! file sh
npm ERR! path sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn sh
npm ERR! bcrypt@1.0.2 install: node-pre-gyp install --fallback-to-build
npm ERR! spawn sh ENOENT
npm ERR!
npm ERR! Failed at the bcrypt@1.0.2 install script ‘node-pre-gyp install --fallback-to-build’.

etc…

This problem is NOT new, many people have reported the issue. But so far I did not manage to find any solution.

Do I do something wrong? Is it related to a buggy software (why the development version works than?!) Do I miss the correct procedure (please, give me a link!).

Any help is deeply appreciated!!!

I manage to make one step forward, by replacing bcrypt package with bcryptjs.

Now the item [10] from the list finishes without error. For the next step [11] I had to install fibers package:
11. setup MONGO_URL, ROOT_URL, run node main.js

error:

There is an issue with node-fibers

/home/az/cdb/bundle/programs/server/node_modules/fibers/bin/linux-ia32-51/fibers.node is missing.

I followed the instructions on fibers rebuild, and one of the directories was updated:

drwxr-xr-x 1 az az 22 Oct 6 2016 linux-x64-48
drwxr-xr-x 1 az az 22 May 10 03:50 linux-x64-51 <---- This one, my server is x86_64
-rw-r–r-- 1 az az 0 Oct 6 2016 .npmignore
-rwxr-xr-x 1 az az 1175 Oct 6 2016 repl

But I have no idea why the architecture linux-ia32-51 is requested!

OK, it was a bad version of fibers package. I have installed this one:
npm install --save neo4j-fiber

And now, after setting …

MONGO_URL=mongodb://localhost/cdb
ROOT_URL=http://localhost:3001
node main.js

… the code runs, but I see nothing on http://localhost:3001

OK, I got it! This is the correct environment.

PORT=3000 ROOT_URL=http://localhost MONGO_URL=mongodb://localhost:27017/myappname node main.js

Lessons learnt so far:

  1. the bundle produced by meteor build … does not work out of the box;
  2. the package bcrypt is buggy, it should be replaced by bcryptjs;
  3. the production version depends on fiber package, to be installed via npm install --save neo4j-fiber;

Next step: SSL configuration of nodeJS.