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.

Unexpected token import when running `getStorybook`

See original GitHub issue

I installed storybook globally, but when I run getStorybook I get the following error:

/Users/username/.nvm/versions/node/v8.1.3/lib/node_modules/@storybook/cli/bin/generate.js:1
(function (exports, require, module, __filename, __dirname) { import updateNotifier from 'update-notifier';
                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/username/.nvm/versions/node/v8.1.3/lib/node_modules/@storybook/cli/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)

Is it my node version?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nickjohnson-devcommented, Oct 2, 2017

I just had this issue as well. Downgrading to storybook/cli@3.2 fixed it.

@shilman: Looks like the 3.3.0-alpha.1 version got published on the latest tag. I’m not sure if this was on purpose or not, but just wanted to let you know.


Update: With version 3.2 the cli works fine, but it’s installing @ storybook/react@3.3.0-alpha.1, and that appears to be broken as well.

Update 2: After blowing my node_modules away, @ storybook/react@3.3.0-alpha.1 seems to be working okay.

0reactions
nickjohnson-devcommented, Oct 3, 2017

I’ve had my fair share of NPM disasters, I know those are stressful. 😥

Thanks for the quick work on this bug, and on the great work in general. I’m loving this great tool as always! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest - react-native SyntaxError: Unexpected token import
I am running jest test in react native and it fails giving "SyntaxError: Unexpected token import". Here is my trimmer import code: -...
Read more >
How I Fixed The Unexpected Token Error In Jest
With these settings, I can now run npm test and it properly runs my tests - including those that require an import of...
Read more >
jest encountered an unexpected token this usually means that ...
Test suite failed to run Jest encountered an unexpected token This usually means that you are trying to import a file which Jest...
Read more >
Running Jest for Typescript CLI - unexpected token at import
Hi, I built a small CLI and set up Jest for my project. So far I only have a little experience with running...
Read more >
SyntaxError: Unexpected token import in Node.js | bobbyhadz
The SyntaxError: Unexpected token import occurs when we use the ES6 import syntax in a version of Node that doesn't support it. To...
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