My project uses Babel 5. Following the setup example, I when I run npm run storybook, I get:
ERROR in ./.storybook/config.js
Module build failed: ReferenceError: [BABEL] /Users/dan/projects/my-project/.storybook/config.js: Unknown option: direct.presets
at Logger.error (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
at OptionManager.mergeOptions (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
at OptionManager.init (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:216:10)
at File.initOptions (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/file/index.js:147:75)
at new File (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/file/index.js:137:22)
at Pipeline.transform (/Users/dan/projects/my-project/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at transpile (/Users/dan/projects/my-project/node_modules/babel-loader/index.js:12:22)
at Object.module.exports (/Users/dan/projects/my-project/node_modules/babel-loader/index.js:69:12)
@ multi preview
It comes from the Webpack output. This error seems like a Babel 5/6 mismatch of some sort. Should Babel 6 be a peer dependency, or is this able to work with legacy Babel?
Node 4.2.0 / NPM 3.8.1
Yes I think that's the issue. It's try to load babel5 inside this where we don't support.
I didn't find this. I assume, you need to upgrade to babel6 for now.
I'll see what I can do about this.
I upgraded to Babel 6 and it works well. The bug is in Babel, and I couldn't figure out what was going wrong.
It may be worth considering making babel v6 a peer dependency and call it good.
Cool. I think that's something we can do.
I think we can close this now. Since everybody is using babel6.
If anyone Googles into here, I was getting a similar, but slightly different, error:
ERROR in ./storybook/addons.js
Module build failed: ReferenceError: [BABEL] /Users/gerard/_work/crossroads-anywhere/react-native/storybook/addons.js: Unknown option: direct.presets
at Logger.error (/Users/gerard/_work/crossroads-anywhere/react-native/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
npm ls babel-core gave me:
โโโฌ @storybook/[email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
It sounded like Babel 5 was the problem, so I had to explicitly install Babel 6: npm i --save-dev [email protected]. Not sure if that's a good idea or not, but it fixes the error and everything in my project still appears to be working.
Thanks for posting your solution @hellogerard !
Most helpful comment
If anyone Googles into here, I was getting a similar, but slightly different, error:
npm ls babel-coregave me:It sounded like Babel 5 was the problem, so I had to explicitly install Babel 6:
npm i --save-dev [email protected]. Not sure if that's a good idea or not, but it fixes the error and everything in my project still appears to be working.