storybook: Knobs not working with v5.2.0-beta.30
Describe the bug When enabling the Knobs in the project, I get following error:
Storybook preview hooks can only be called inside decorators and story functions.
To Reproduce
Install and enable Knobs in v5.2.0-beta.30:
addons.js:
import '@storybook/addon-knobs/register';
config.js:
addDecorator(withKnobs);
Expected behavior Stories should be rendered correctly.
Screenshots

System:
Environment Info:
System:
OS: Linux 5.1 Ubuntu 19.04 (Disco Dingo)
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 12.3.1 - ~/.nvm/versions/node/v12.3.1/bin/node
npm: 6.9.0 - ~/.nvm/versions/node/v12.3.1/bin/npm
Browsers:
Chrome: 74.0.3729.108
Firefox: 68.0.1
npmPackages:
@storybook/addon-actions: ^5.2.0-beta.30 => 5.2.0-beta.30
@storybook/addon-info: ^5.2.0-beta.30 => 5.2.0-beta.30
@storybook/addon-knobs: ^5.2.0-beta.30 => 5.2.0-beta.30
@storybook/addon-options: ^5.2.0-beta.30 => 5.2.0-beta.30
@storybook/addon-viewport: ^5.2.0-beta.30 => 5.2.0-beta.30
@storybook/react: ^5.2.0-beta.30 => 5.2.0-beta.30
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 16 (5 by maintainers)
I am pretty sure it was caused by the wrong import:
instead of
I’m having this issue with
v5.1.11.@matyasfodor we have to work with different frameworks, so we’ve reimplemented hooks in a framework-independent way
@daniloprates @bencmbrook @ashoksudani @loicbourg @vernonk can you please try version
5.2.4?I was have same error with
v5.1.9. In my case it was fixed with upgrading allstorybookpackages tov5.3.8.Update: upgrading both @storybook/addon-knobs and @storybook/react-native to ^5.3.0-alpha.42 fixed it for me (reminding I am using storybook client only in react-native)
After upgrading to
5.2.0-beta.33, everything works fine. Can’t say if it was just a matter of reinstall.