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.

Unknown option: direct.presets

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
hellogerardcommented, Aug 21, 2017

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/cli@3.2.4
│ └─┬ jscodeshift@0.3.32
│   └── babel-core@5.8.38 

It sounded like Babel 5 was the problem, so I had to explicitly install Babel 6: npm i --save-dev babel-core@6.26.0. 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.

1reaction
quicksnapcommented, Apr 1, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown option: presets · Issue #2949 · babel/babel - GitHub
I'm in the same boat. I'm using babel@6 with babel-loader (webpack) I've updated all my dependencies to @6 versions, both in the project...
Read more >
26 - Stack Overflow
The reason was that I was trying to use react preset for babel but babel-react-preset was missing from my node_modules .The end result...
Read more >
Module build failed: ReferenceError [BABEL] Unknown option
gulp does not work: Module build failed: ReferenceError [BABEL] Unknown option: direct.presets. We use Laravel 5.3.x and have elixir for build assets.
Read more >
babel/preset-react
@babel/preset-react ... This preset always includes the following plugins: ... And with the development option: Classic runtime adds: ... Automatic runtime (since v7....
Read more >
babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
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 Hashnode Post

No results found