Having issues running a production Meteor application on CentOS 6.10 after upgrading to Meteor 1.7.0.3? Yeah, me too.

I spent a good while last night Googling different errors I came across when trying to run a newly upgraded, custom deployed version of my Meteor app. The system had a previous version of the app running on a older version of Meteor (1.3.4.1), and after running a meteor update, it no longer would run!

Here’s a few errors I ran across:

  • error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20′ not found
  • cc1plus: error: unrecognized command line option “-std=gnu++1y”
  • Failed at the [email protected] install script.
  • node-gyp exited with code: 1 Please make sure you are using a supported platform and node version.
  • let notifier = require(‘update-notifier’)({pkg})

My first thought was the Node version installed on the system was out of date. Running node -v showed the system was running node 0.10, so I went about updating it. Running yum update didn’t find any updates, so I went to the node website and grabbed the latest source to compile. That didn’t work, but in the process of a little more Googling, I found a cool tool called n. N is a node version management tool, making it very easy to switch node and npm versions with very little work.

npm install -g n
n latest

You can also install specific versions by running n 10.8.0

I thought having the latest Node.js would fix the problem, but I still couldn’t run my app. Fibers was getting pissed at the version of GCC on the system, so I went and grabbed a version of GCC a few google searches said would do the trick. After about an hour of compiling, it still wouldn’t compile fibers.

All in all, I finally got it to work by blowing away my ~/.npm directory, node_modules, and installing the latest version of GCC.

Here’s what finally got it running:

Please note before continuing, this app was the only Node application on this system and I did not care about blowing away all of the node_modules. If you are running multiple node apps, you may not want to rm -rf the entire node_modules directory. Proceed with caution!

n 10.8.0
yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
source scl_source enable devtoolset-7
sudo rm -rf /usr/local/lib/node_modules/
sudo rm -rf ~/.node-gyp/
sudo rm -rf ~/.npm/
cd /home/wreiske/prod/bundle/programs/server
npm prune
npm rebuild
npm install
cd /home/wreiske/prod
./start.sh

Boom! Fibers compiled, all the packages installed, and node is up and running.

Just so nobody is confused about what the start.sh does, it basically kills any running node processes on port 3000, sets up environment variables, and then starts up node.

:

cd bundle
OLD=`lsof -i :3000 | grep LISTEN | awk '{ print $2 }'`
if [ "$OLD" != "" ]
then
  echo "Killing old process $OLD"
  kill $OLD
fi

if [ "$1" == "stop" ]
then
        echo stopping
        exit
fi
source scl_source enable devtoolset-7
(cd programs/server && npm install)
export BIND_IP=127.0.0.1
export PORT=3000
export HTTP_FORWARDED_COUNT=1
export MONGO_URL=mongodb://localhost:27017/prodapp
export ROOT_URL=https://prodapp.domain/
nohup node main.js >> ../prodapp.log 2>&1 </dev/null &

If you want to use it, make sure you update the environment variables (MONGO_URL, ROOT_URL, etc.) to fit your needs.

Hope this helps save someone some valuable time trying to get their updated app working. Another solution may be to install CentOS 7, but that was not an option for this system.

I will soon be creating an Ansible / Vagrant up Meteor deployment using nginx, nodejs, mongodb in a virtual machine. Be sure to subscribe if you’d like an email update of when I post it.

-Will

Meteor 1.7.0.3 fibers fix to run on CentOS 6.10
Tagged on: