Skip to content

Show nice error when attempting to ng-add something that doesn't exist #10467

Closed
@StephenFluin

Description

@StephenFluin

Versions

Angular CLI: 6.0.0-rc.6

Repro steps

ng new my-app
cd my-app
ng add @angular/material@5.2.9

Observed behavior

Installed packages for tooling via npm.
Cannot read property 'startsWith' of undefined
TypeError: Cannot read property 'startsWith' of undefined
    at NodeModulesEngineHost._resolvePath (/super/workspace/test/material-test/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:31:18)
    at NodeModulesEngineHost._resolveCollectionPath (/super/workspace/test/material-test/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:69:35)
    at NodeModulesEngineHost.createCollectionDescription (/super/workspace/test/material-test/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:106:27)
    at SchematicEngine._createCollectionDescription (/super/workspace/test/material-test/node_modules/@angular-devkit/schematics/src/engine/engine.js:78:40)
    at SchematicEngine.createCollection (/super/workspace/test/material-test/node_modules/@angular-devkit/schematics/src/engine/engine.js:71:43)
    at Object.getCollection (/super/workspace/test/material-test/node_modules/@angular/cli/utilities/schematics.js:28:31)
    at AddCommand.getOptions (/super/workspace/test/material-test/node_modules/@angular/cli/models/schematic-command.js:187:41)
    at AddCommand.<anonymous> (/super/workspace/test/material-test/node_modules/@angular/cli/commands/add.js:29:49)
    at Generator.next (<anonymous>)
    at /super/workspace/test/material-test/node_modules/@angular/cli/commands/add.js:7:71

Desired behavior

Show a friendly error message that we couldn't find any schematics in the referenced package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions