gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 10:22:02 31 4
gpt4 key购买 nike

从 github 移过来。原帖https://github.com/emberjs/ember.js/issues/13055

我刚刚开始使用 ember,在使用“ember 服务器”命令时遇到了问题。

我跑了

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 配置导致与 Ember 所依赖的 broccoli-babel-transpiler 不兼容问题。

首先,输入 ls ~/.babelrc 确认文件确实存在

应该返回/Users/Rubbelogbit/.babelrc

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

对于 babel-core@6.x 及更高版本,您只需要 .babelrc 文件。但是,bro​​ccoli 转译器仍在使用 ^5.0。我猜测是因为它位于您的主目录中,所以默认情况下它会尝试使用它。

关于ember-cli - 无法设置本地 ember.js 服务器。 "ember server"命令错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35821117/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com