angular: Cannot find module '@angular-devkit/schematics' while running cmd: ng new --collection=@angular/bazel

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Description

Trying to run ng new --collection=@angular/bazel getting error: Cannot find module ‘@angular-devkit/schematics’ @angular/cli 9.0.1 @angular/bazel 9.0.0

image

🔬 Minimal Reproduction

npm i -g @angular/cli @angular/bazel ng new ng new --collection=@angular/bazel

đŸ”„ Exception or Error


An unhandled exception occurred: Cannot find module '@angular-devkit/schematics'
Require stack:
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\bazel\src\schematics\ng-new\index.js       
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\models\command-runner.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\vltan\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\vltan\AppData\Local\Temp\ng-FnUFw6\angular-errors.log" for further details.

🌍 Your Environment


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

Angular CLI: 9.0.1
Node: 12.15.0
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.1
@angular-devkit/core         9.0.1
@angular-devkit/schematics   9.0.1
@schematics/angular          9.0.1
@schematics/update           0.900.1
rxjs                         6.5.3

Anything else relevant?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 13
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same error. Fixed it with

npm install @angular-devkit/schematics @angular-devkit/core @schematics/angular

Then updated with

npm run ng update @angular/core @angular/cli

Received these messages:

    Package "@angular-devkit/schematics" found in the workspace package.json. This package typically does not need to be installed manually. If it is not being used by project code, it can be removed from the package.json.
    Package "@angular-devkit/core" found in the workspace package.json. This package typically does not need to be installed manually. If it is not being used by project code, it can be removed from the package.json.

Although it only mentions two of the three newly installed packages, i uninstalled all three of them:

npm uninstall @angular-devkit/schematics @angular-devkit/core @schematics/angular

Did you install these globally? No, installed in the project, then run the update.

But if you’re running ng new --collection=@angular/bazel then you don’t have a project yet!

I ran them globally. Then I got Cannot find module 'tslib'. This worked to fix that:

npm install -g tslib

I can actually run ng serve now for the sample project, but I just cannot get past this:

iBazel [3:33PM]: Querying for files to watch
 )) was unexpected at this time. iBazel [3:33PM]: Bazel query failed: exit status 255

Seems they weren’t kidding about bazel not being production ready for angular.

Exactly. The issue is about creating new project, not updating or ng add @angular/bazel. Installing modules globally did the trick. So, just to summarize: run: 1.npm i -g @angular-devkit/schematics @angular-devkit/core @schematics/angular tslib 2. ng new --collection=@angular/bazel 3. ng serve I succeeded to build a project with ng serve on angular 9.0.5

so the bug is actually about having to manually install modules globally

Did you install these globally? No, installed in the project, then run the update.

But if you’re running ng new --collection=@angular/bazel then you don’t have a project yet!

I ran them globally. Then I got Cannot find module 'tslib'. This worked to fix that:

npm install -g tslib

I can actually run ng serve now for the sample project, but I just cannot get past this:

iBazel [3:33PM]: Querying for files to watch
 )) was unexpected at this time. iBazel [3:33PM]: Bazel query failed: exit status 255

Seems they weren’t kidding about bazel not being production ready for angular.

Installing @angular-devkit/schematics @angular-devkit/core @schematics/angular

did the trick, but I guess that this should not need to be a thing in a normal update

I have the exactly same issue since RC8

Did you install these globally? No, installed in the project, then run the update.

But if you’re running ng new --collection=@angular/bazel then you don’t have a project yet! I ran them globally. Then I got Cannot find module 'tslib'. This worked to fix that:

npm install -g tslib

I can actually run ng serve now for the sample project, but I just cannot get past this:

iBazel [3:33PM]: Querying for files to watch
 )) was unexpected at this time. iBazel [3:33PM]: Bazel query failed: exit status 255

Seems they weren’t kidding about bazel not being production ready for angular.

Exactly. The issue is about creating new project, not updating or ng add @angular/bazel. Installing modules globally did the trick. So, just to summarize: run: 1.npm i -g @angular-devkit/schematics @angular-devkit/core @schematics/angular tslib 2. ng new --collection=@angular/bazel 3. ng serve I succeeded to build a project with ng serve on angular 9.0.5

so the bug is actually about having to manually install modules globally

this is work for me. Thanks

Did you install these globally?

Hmm that stack trace makes me think it’s a problem in @angular/bazel itself, which in part of the https://github.com/angular/angular repo. Transferring there.