我正在使用Ember构建一个Web应用程序。我用ember new test-app
创建了项目,并且没有对生成的文件进行任何更改。当我运行ember serve
时,我立即收到以下错误:
The Broccoli Plugin: [BroccoliMergeTrees: Addon#compileAddon(ember-welcome-page) ] failed with: Error: Couldn't find preset "es2015" relative to directory "/Users/jacob" at /Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19 at Array.map () at OptionManager.resolvePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20) at OptionManager.mergePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10) at OptionManager.mergeOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14) at OptionManager.init (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12) at File.initOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:212:65) at new File (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:135:24) at Pipeline.transform (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/pipeline.js:46:16) at Promise (/Users/jacob/Desktop/test-app/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:102:26) The broccoli plugin was instantiated at: at BroccoliMergeTrees.Plugin (/Users/jacob/Desktop/test-app/node_modules/broccoli-plugin/index.js:7:31) at new BroccoliMergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:16:10) at Function.BroccoliMergeTrees [as _upstreamMergeTrees] (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:10:53) at mergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/broccoli/merge-trees.js:85:33) at Class.compileAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:1092:12) at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:746:26) at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-welcome-page/index.js:27:41) at Class.superWrapper [as treeForAddon] (/Users/jacob/Desktop/test-app/node_modules/core-object/lib/assign-properties.js:34:20) at Class._treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:557:33) at Class.treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:517:21)
我提到了this question寻求帮助,但在尝试解决方案后仍然收到了同样的错误。
我在macOS High Sierra上运行ember-cli v2.16.2和node v8.9.0。在我的节点安装中,我安装的唯一三个全局模块是bower,broccoli-cli和ember-cli。
答案 0 :(得分:1)
请干净重新安装ember-cli包。
npm uninstall -g ember-cli
npm cache clean --force
npm install -g ember-cli
然后再次运行你的ember new命令并进行测试。