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.

Not reporting errors when using Angular runner

See original GitHub issue

Describe the bug When using the Angular CLI runner (like ng run storybook) instead of the normal npm run storybook there is just an cryptic message when I have errors within a story when launching Storybook

To Reproduce I created a demo repository using just an Angular init and added Storybook. You can access it here: https://github.com/emrox/angular-error-reporting

  • in https://github.com/emrox/angular-error-reporting/commit/39e6f37cd500b00b26d64f33eb7de28aa6a12408 I added a simple import error.

  • when you checkout this commit and run Storybook with npm run storybook you can see an output like this:

     {
       rawMessage: "ERROR TS2307: Cannot find module 'not/exiting/file' or its corresponding type declarations.",
       message: '\x1B[1m\x1B[31mERROR in \x1B[39m\x1B[22m\x1B[1m\x1B[36m/path/to/repository/src/stories/Button.stories.ts(4,31)\x1B[39m\x1B[22m\x1B[1m\x1B[31m:\x1B[39m\x1B[22m\n' +
      "\x1B[90mTS2307: \x1B[39mCannot find module 'not/exiting/file' or its corresponding type declarations.",
       location: { line: 4, character: 31 },
       file: '/path/to/repository/src/stories/Button.stories.ts'
     }
    
  • when I add the ng config into angular.json file (done in https://github.com/emrox/angular-error-reporting/commit/63e1d07b268c2f5862dfe2fbce3e2ad00c3384f1) and run ng serve storybook, you just get a very cryptic error message

    Unknown error: TypeError: Converting circular structure to JSON
        --> starting at object with constructor 'Compiler'
        --- property 'root' closes the circle
    

    Here I would expect to get the same error as I get with npm run storybook

  • Also both variants do not report errors with an already running Angular Storybook dev server when adding an error. (Then the component is just not shown in Storybook)

System

Environment Info:

  System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.4.1 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 7.18.1 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 89.0.2
    Safari: 14.1.1
  npmPackages:
    @storybook/addon-actions: ^6.3.4 => 6.3.4
    @storybook/addon-essentials: ^6.3.4 => 6.3.4
    @storybook/addon-links: ^6.3.4 => 6.3.4
    @storybook/angular: ^6.3.4 => 6.3.4
    @storybook/builder-webpack5: ^6.3.4 => 6.3.4
    @storybook/manager-webpack5: ^6.3.4 => 6.3.4
  npmGlobalPackages:
    @storybook/addon-docs: 6.3.0-rc.11
    @storybook/root: 6.3.0-rc.11

prob also interesting:

    "@angular/core": "^12.0.5",

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shilmancommented, Sep 16, 2021

¡Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.37 containing PR #15978 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

1reaction
ThibaudAVcommented, Sep 1, 2021

if it’s the same problem. (error interception problem with angular builder) I had written it down to invest in it later, but now I’ll look at it sooner 😃

i think we need to discover this object to get error.

https://github.com/storybookjs/storybook/blob/next/app/angular/src/builders/start-storybook/index.ts#L84

with this path error.compilation.errors i’ve a better error :

{
    rawMessage: "ERROR TS2307: Cannot find module 'not/exiting/file' or its corresponding type declarations.",
    message: '\x1B[1m\x1B[31mERROR in \x1B[39m\x1B[22m\x1B[1m\x1B[36m/Users/thibaud/sb-workspace/angular-error-reporting/src/stories/Button.stories.ts(4,31)\x1B[39m\x1B[22m\x1B[1m\x1B[31m:\x1B[39m\x1B[22m\n' +
      "\x1B[90mTS2307: \x1B[39mCannot find module 'not/exiting/file' or its corresponding type declarations.",
    location: { line: 4, character: 31 },
    file: '/Users/thibaud/sb-workspace/angular-error-reporting/src/stories/Button.stories.ts'
  }

I will see to propose PR quickly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >
Angular compiler does not report template error but IntelliJ does
I know there's a similar question here: Angular Compiler not reporting missing property in template. But I already have set strictTemplates: ...
Read more >
Error Handling with Angular 8 - Tips and Best Practices - Rollbar
One traditional way of handling errors in Angular is to provide an ErrorHandler class. This class can be extended to create your own...
Read more >
Errors List - Angular
Errors Listlink · NG0100: Expression Changed After Checked · NG01003: Wrong Async Validator Return Type · NG01203: Missing value accessor · NG0200: Circular ......
Read more >
Read your production Angular Errors like a pro - Medium
The above example is no exception. So even if we get lucky and witness this error (which is not always a case because...
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