错误:无法找到预设" es2015"相对于目录 - Intellij Filewatcher

时间:2016-08-25 06:17:11

标签: javascript intellij-idea ecmascript-6 babeljs file-watcher

尝试使用Intellij设置Filewatcher,以便将ES6与Babel转换器一起使用。我已经按照他们的指南here,这似乎安装得很好,除了当我尝试编写javascript代码并执行转换器代码时,我收到此错误:

Error: Couldn't find preset "es2015" relative to directory "/Volumes/ShanStore/Main/Projects/NewWebsite"
at /Users/Shan/node_modules/babel-core/lib/transformation/file/options/option-manager.js:281:17
at Array.map (native)
at OptionManager.resolvePresets (/Users/Shan/node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:20)
at OptionManager.mergePresets (/Users/Shan/node_modules/babel-core/lib/transformation/file/options/option-manager.js:254:10)
at OptionManager.mergeOptions (/Users/Shan/node_modules/babel-core/lib/transformation/file/options/option-manager.js:239:14)
at OptionManager.init (/Users/Shan/node_modules/babel-core/lib/transformation/file/options/option-manager.js:338:12)
at File.initOptions (/Users/Shan/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/Shan/node_modules/babel-core/lib/transformation/file/index.js:137:24)
at Pipeline.transform (/Users/Shan/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transform (/Users/Shan/node_modules/babel-cli/lib/babel/util.js:50:22)

我安装了Node v6.4.0npm 3.10.3。我的根目录中有一个名为.babelrc的文件,如此 -

NewWebsite
  |_ .babelrc
  |_ index.html
  |_ script.js

我运行这些命令来安装与babel相关的东西:

sudo npm install --save-dev babel-cli
sudo npm install --save-dev babel-preset-es2015

我的.babelrc文件如下所示:

{
  "presets": ["es2015"]
}

我在这里搜索了各种解决方案,但没有一个能够奏效。我不知道这里有什么问题!有什么帮助吗?

0 个答案:

没有答案