I'm trying to setup babel on Ubuntu 14.04 but it doesn't seem to be working!
Here are some outputs that may be required:
$ which node
/usr/sbin/node
$ which nodejs
/usr/bin/nodejs
$ which babel
/usr/local/bin/babel
$ which babel-node
/usr/local/bin/babel-node
When I execute babel
or babel-node
the prompt just returns. The same happens on executing the commands with a filename as argument. (The file has just console.log("hello")
.
How do I fix this?
The
/usr/sbin/node
vs/usr/bin/nodejs
issue has been covered in Cannot install packages using node package manager in Ubuntu but basically Ubuntu has a separatenode
package that is NOT Node.js. The package for Node.js on Ubuntu is callednodejs
. If you have both installed, it means your scripts will try to run using the other unrelated application. One option is to symlinknodejs
tonode
.The best solution however would be to use something like
nvm
to install node for your user without installing it globally. Then you can install and update node versions extremely easily, and your PATH will always referencenode
properly.Changing
node
tonodejs
in the first line of/usr/local/bin/babel-node
and/usr/local/bin/babel
solves it.