Skip to content

Unable to find "@angular/cli" in devDependencies in library projects #16596

Description

@alan-agius4

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

When running the ng command in a library project it will emit a warning Unable to find "@angular/cli" in devDependencies

🔬 Minimal Reproduction

  • npx @angular/cli@next new test --create-application false --minimal
  • ng g lib foo
  • cd foo
  • ng g c bar --skip-import

🔥 Exception or Error


alan@Alans-iMac foo % pwd  
/Users/alan/git/cli-repos/packagr/projects/foo
alan@Alans-iMac foo % ng g c bar --skip-import
Unable to find "@angular/cli" in devDependencies.

Please take the following steps to avoid issues:
"npm install --save-dev @angular/cli@latest" 

CREATE projects/foo/bar/bar.component.css (0 bytes)
CREATE projects/foo/bar/bar.component.html (18 bytes)
CREATE projects/foo/bar/bar.component.spec.ts (607 bytes)
CREATE projects/foo/bar/bar.component.ts (257 bytes)

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.0-rc.7
Node: 12.12.0
OS: darwin x64

Angular: 9.0.0-rc.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-rc.7
@angular-devkit/build-angular      0.900.0-rc.7
@angular-devkit/build-ng-packagr   0.900.0-rc.7
@angular-devkit/build-optimizer    0.900.0-rc.7
@angular-devkit/build-webpack      0.900.0-rc.7
@angular-devkit/core               9.0.0-rc.7
@angular-devkit/schematics         9.0.0-rc.7
@ngtools/webpack                   9.0.0-rc.7
@schematics/angular                9.0.0-rc.7
@schematics/update                 0.900.0-rc.7
ng-packagr                         9.0.0-rc.5
rxjs                               6.5.4
typescript                         3.6.4
webpack                            4.41.2
    

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions