Search code examples
javascriptnpmember.jsbuildbroccolijs

Ember build failed because of broccoliBuilderError


I am on an ember project and I am trying to upgrade ember version from 2.8 to 3.5.0. But since I changed the version and also some several dependencies version I get this error :

Error stack

I've tried to fix this with ember-cli-build file but the error persisted.

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
    const isPublicEnv = EmberApp.env() === 'public';

    const app = new EmberApp(defaults, {

        'sassOptions': {
            includePaths: [
                'bower_components/materialize/sass',
            ],
        },
        'outputPaths': {
            app: {
                css: {
                    design1: '/assets/design1.css',
                    design2: '/assets/design2.css'
                },
            },
        },
        'ember-cli-babel': {
            includePolyfill: true,
        },
        'minifyJS': {
            enabled: isPublicEnv,
        },
        'minifyCSS': {
            enabled: isPublicEnv,
        },
        'fingerprint': {
            enabled: isPublicEnv,
        },
        'tests': !isPublicEnv,
        'hinting': !isPublicEnv,
        'sourcemaps': {
            enabled: !isPublicEnv,
        },
    });

    app.import('vendor/lib1.js');
    app.import('vendor/lib2.js');

    return app.toTree();
};

Any suggestion to resolve this ?


Solution

  • This is the code that's failing from your stack trace from ember-cli-htmlbars-inline-precompile:

    templateCompilerPath() {
        let config = this.projectConfig();
        let templateCompilerPath = config['ember-cli-htmlbars'] && config['ember-cli-htmlbars'].templateCompilerPath;
    
        let ember = this.project.findAddonByName('ember-source');
        if (ember) {
          return ember.absolutePaths.templateCompiler;
        }
    
        return path.resolve(this.project.root, templateCompilerPath);
    }
    

    This line let ember = this.project.findAddonByName('ember-source'); must be the culprit. Although Ember switched from bower to npm around 2.11 iirc, the only way you could be getting Ember > 3.0 is via npm since the last bower pushed version was the end of 2.x.

    I suspect you are on an old version of ember-cli that needs to also be updated since ember is not found. Which version of ember-cli are you using?