babel.js不产生任何输出 [英] babel.js produces no output
问题描述
它已安装($ sudo npm install babel
),运行$ babel
不会产生任何结果(暗示bash可以找到某些东西),但是$ babel foo.js
不会产生任何输出,并且类似地,用于输出文件的各种babel命令也会被忽略.
It's installed ($ sudo npm install babel
), running $ babel
produces nothing (implying that bash can find something) but $ babel foo.js
produces no output, and the various babel commands for it to output files are similarly ignored.
推荐答案
当我不使用任何命令运行babel
时,它将等待来自stdin的输入并使用control-C关闭.
When I run babel
with no command it waits for input from stdin and closes with control-C.
您可以尝试使用npm install --global babel
.
并确保foo.js
中有一些js.然后babel foo.js
应该输出转换后的代码.
And make sure there is some js in foo.js
. Then babel foo.js
should output the transformed code.
要检查babel版本,请使用babel --version
.
To check babel version use babel --version
.
发生在我身上的一件事是,我在scripts
下的package.json
中将babel命令作为build
,然后运行了npm build
,却没有看到混乱的输出. npm run build
可以.
One thing that happened to me is that I put a babel command in package.json
under scripts
as build
, then I ran npm build
and saw no output confusingly. npm run build
works though.
这篇关于babel.js不产生任何输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!