Skip to content

Cannot find module ember-cli/lib/broccoli/ember-app error in monorepo #7

@tomwayson

Description

@tomwayson

After installing this into my ember app I get the following error when running ember asset-sizes:

Cannot find module '/Users/tom/<monorepo-root>/packages/<ember-app>/node_modules/ember-cli/lib/broccoli/ember-app'


Stack Trace and Error Report: /var/folders/_6/dgtlmj695fv5yds8f5hwvcbs8snz_f/T/error.dump.e5067a82d42b320f08aa37979af1831a.log
An error occurred in the constructor for ember-cli-asset-sizes-shim at /Users/tom/<monorepo-root>/node_modules/ember-cli-asset-sizes-shim

Note that my app is in a monorepo using yarn workspaces, so I have to use yarn add ember-cli-asset-sizes-shim and then ember generate ember-cli-asset-sizes-shim to install the addon, and that also returns the above error.

It looks like the error comes from these hardcoded paths:

var pathToApp = path.join(this.project.root, 'node_modules/ember-cli/lib/broccoli/ember-app');
var pathToAddonModel = path.join(this.project.root, 'node_modules/ember-cli/lib/models/addon');

Those would probably need to use require.resolve() in order to work in a monorepo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions