question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

🐞 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?

Issue Analytics

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

github_iconTop GitHub Comments

9reactions
tfrijsewijkcommented, Feb 10, 2020

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
3reactions
vltanskycommented, Mar 6, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot - find - module - '@angular-devkit/schematics'
When I tried installing angular material to my project I got the same error like. Cannot find module '@angular-devkit/schematics/tasks' inΒ ...
Read more >
Schematics for libraries - Angular
The Angular CLI uses this entry to find named schematics in your collection when it runs commands. projects/my-lib/package.json (Schematics Collection Reference)
Read more >
@angular-devkit/schematics - npm
Start using @angular-devkit/schematics in your project by running `npm i @angular-devkit/schematics`. There are 1679 other projects in theΒ ...
Read more >
Cannot find module '@angular-devkit/build-angular ... - YouTube
An unhandled exception occurred: Cannot find module '@ angular - devkit /build-angular/package.json'The above exception while running an angularΒ ...
Read more >
cannot find module '@angular-devkit/schematics' - You.com ...
This is happening because of your node_modules does not contain the material directory. To add Material into your node_modules run below command. npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found