Error This Version of Node/Nan/V8 Requires a C++11 Compiler
I've Recently Upgraded Nodejs from 0.13 to 6.9 and I Started Getting Some Errors When Running My Nodejs App, I Googled Around, Managed to Fix Some Errors and...
I've recently upgraded Nodejs from 0.13 to 6.9 and I started getting some errors when running my nodejs app, I googled around, managed to fix some errors and new ones appeared, I ended up deleting the node_modules folder of my app, clearing npm's cache and running the npm install again and this is where I am stuck, you can see the full output in this pastebin.
More details:
- Ubuntu 12.04
- Nodejs v6.9.1 (both
node --versionandnodejs --versionreturn the same) - node-gyp, clang, gcc, make and build-essential are all installed
Node modules my app uses:
"dependencies": {
"socket.io": "~1.2.1",
"kurento-client": "Kurento/kurento-client-js",
"mongoose": "~3.8.23",
"dateformat": "~1.0.11",
"underscore": "~1.8.3"
}
I've been trying the solutions from here to no avail.
How can I fix this?
1 Answer
Finally solved this, I'll leave the solution here for whomever runs into the same problem.
Here's what the problem was, Unbuntu 12.04 only has gcc 4.6.3 in the official repository, but C++11 is only supported from 4.8.1, therefore you need to install 4.8 from a different PPA:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
Now this alone did not fix the problem since it seems node-gyp uses g++ instead of gcc so just do the same for g++:
sudo apt-get install g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
after that sudo npm install should run without problems.