无法设置本地 ember.js 服务器。 "ember server" 命令出错

Cant setup local ember.js server. Error on "ember server" command

从 github 移动而来。原线程 https://github.com/emberjs/ember.js/issues/13055

我刚开始使用 ember,但在使用 'ember server' 命令时我 运行 遇到了问题。

我运行

npm install -g ember-cli
npm install -g phantomjs
npm new test1
cd test1
ember server

并得到以下错误信息:

version: 2.4.1
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
File: modules/ember-ajax/errors.js
The Broccoli Plugin: [Babel] failed with:
ReferenceError: [BABEL] modules/ember-ajax/errors.js: Unknown option:          /Users/Rubbelogbit/.babelrc.presets
at Logger.error (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
at OptionManager.mergeOptions (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
at OptionManager.addConfig (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
at OptionManager.findConfigs (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
at OptionManager.init (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
at File.initOptions (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:147:75)
at new File (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/file/index.js:137:22)
at Pipeline.transform (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at Babel.transform (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:94:21)
at Babel.processString (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:123:25)

The broccoli plugin was instantiated at:
at Babel.Plugin (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/node_modules/broccoli-plugin/index.js:7:31)
at Babel.Filter [as constructor] (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-persistent-filter/index.js:38:10)
at new Babel (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:34:10)
at Babel (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/index.js:29:12)
at Object.registry.add.toTree (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli-babel/index.js:21:52)
at /Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:184:26
at Array.forEach (native)
at processPlugins (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:182:11)
at Function.module.exports.preprocessJs (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-cli/node_modules/ember-cli-preprocess-registry/preprocessors.js:175:10)
at Class.Addon.preprocessJs (/Users/Rubbelogbit/Desktop/myWebsites/test1/node_modules/ember-      cli/lib/models/addon.js:682:23)

老实说,我不知道该怎么做才能解决它。我已经用谷歌搜索这个问题几个小时了,现在运气好。

我也确实找不到 Users/Rubbelogbit/.babelrc.presets.

有人可以为我解释错误消息或者想出一个修复方法吗? 欢迎任何建议和想法,我真的很想 ember 正确设置以便我可以使用它。

您的全局 Babel 配置似乎导致了与 broccoli-babel-transpiler 不兼容的问题,Ember 依赖于此。

首先,输入 ls ~/.babelrc

确认文件确实存在

哪个应该return/Users/Rubbelogbit/.babelrc

然后键入 rm ~/.babelrc 删除文件。

babel-core@6.x 及更高版本只需要 .babelrc 文件。但是,西兰花转译器仍在使用 ^5.0。我猜是因为它在您的主目录中,它试图默认使用它。