Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Component is part of the declarations of 2 modules: #14698

Closed
patou opened this issue Apr 22, 2021 · 2 comments
Closed

Type Component is part of the declarations of 2 modules: #14698

patou opened this issue Apr 22, 2021 · 2 comments

Comments

@patou
Copy link

patou commented Apr 22, 2021

Describe the bug
The first time the component display well, but the second time, this error is displayed :

Unhandled Promise rejection: Type UserAccountComponent is part of the declarations of 2 modules: StorybookModule and StorybookModule! Please consider moving UserAccountComponent to a higher module that imports StorybookModule and StorybookModule. You can also create a new NgModule that exports and includes UserAccountComponent then import that NgModule in StorybookModule and StorybookModule. ; Zone: <root> ; Task: Promise.then ; Value: Error: Type UserAccountComponent is part of the declarations of 2 modules: StorybookModule and StorybookModule! Please consider moving UserAccountComponent to a higher module that imports StorybookModule and StorybookModule. You can also create a new NgModule that exports and includes UserAccountComponent then import that NgModule in StorybookModule and StorybookModule.

I had this error next this issues #14631

System

Environment Info:

System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
Binaries:
Node: 12.11.1 - C:\PBapps\ctlm-myeclipse\nvm-1.1.7\nodejs\node.EXE
npm: 6.13.6 - C:\PBapps\ctlm-myeclipse\nvm-1.1.7\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.18362.449.0)
npmPackages:
@storybook/addon-actions: ^6.2.8 => 6.2.8
@storybook/addon-essentials: ^6.2.8 => 6.2.8
@storybook/addon-links: ^6.2.8 => 6.2.8
@storybook/angular: ^6.2.8 => 6.2.8

Additional context
The UserAccountComponent.strory :

import { UserAccountComponent } from './user-account.component';
import { Story, Meta, moduleMetadata } from '@storybook/angular';
import { SharedModule } from '@/app/shared/shared.module';

export default {
  title: 'Atoms/User Account',
  component: UserAccountComponent,
  decorators: [
    moduleMetadata({
        imports: [SharedModule]
    })
  ]
} as Meta;

const Template: Story<UserAccountComponent> = (args: UserAccountComponent) => ({
  props: args
});

export const UserAccount = Template.bind({
  connected: false,
  template: `<mat-icon class="a-sid-user-account" matBadge="0" matBadgePosition="below" matBadgeColor="primary" matBadgeSize="small">
  account_circle
</mat-icon>`
});
@xavidram
Copy link

I had to downgrade to @storybook/angular 6.1.21 to get it to work. Problem now is that when I close vs-code and come back later and re run npm run storybook I get the same error again. Upon deleting the node modules and re-installing, @storybook/links-addon prompts me to select the version I would like to install, so I go down and select v6.1.21 and let it install. Then I ran run it again to get it working.

@shilman
Copy link
Member

shilman commented Apr 23, 2021

closing as dupe to #14026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants