从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,以便我可以使用它。
答案 0 :(得分:7)
看起来你有一个全球性的Babel配置会导致与broccoli-babel-transpiler
不兼容的问题,这是Ember所依赖的。
首先,通过键入ls ~/.babelrc
哪个应该返回/Users/Rubbelogbit/.babelrc
然后输入rm ~/.babelrc
删除文件。
您只需要.babelrc
及以上的babel-core@6.x
文件。然而,西兰花转运蛋白仍在使用^5.0
。我猜测是因为它在您的主目录中,它默认尝试使用它。