$ babel和$ babel-node不会启动REPL [英] $ babel and $ babel-node don't launch the REPL

查看:108
本文介绍了$ babel和$ babel-node不会启动REPL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Ubuntu 14.04上设置babel,但似乎无法正常工作!

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

当我执行babelbabel-node时,提示仅返回.在执行以文件名作为参数的命令时,也会发生同样的情况. (文件只有console.log("hello").

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").

我该如何解决?

推荐答案

/usr/sbin/node vs /usr/bin/nodejs问题已在

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 separate node package that is NOT Node.js. The package for Node.js on Ubuntu is called nodejs. If you have both installed, it means your scripts will try to run using the other unrelated application. One option is to symlink nodejs to node.

但是,最好的解决方案是使用类似 nvm 的方法为您的用户安装节点无需在全球范围内安装.然后,您可以非常轻松地安装和更新节点版本,并且PATH将始终正确引用node.

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 reference node properly.

这篇关于$ babel和$ babel-node不会启动REPL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆