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

Unable to start ladle due to import issue #169

Closed
GeorgeNagel opened this issue Jun 21, 2022 · 2 comments
Closed

Unable to start ladle due to import issue #169

GeorgeNagel opened this issue Jun 21, 2022 · 2 comments
Labels
needs reproduction Can't be reproduced

Comments

@GeorgeNagel
Copy link
Contributor

Describe the bug
I am unable to start up ladle due to an issue around an import statement in the cli.js file.

Reproduction

mkdir my-ladle
cd my-ladle
pnpm init
pnpm add @ladle/react react react-dom
mkdir src
echo "export const World = () => <p>Hey</p>;" > src/hello.stories.tsx
pnpm ladle serve
...
<stuff>/my-ladle/node_modules/.pnpm/@ladle+react@1.1.2_biqbaboplfbrettd7655fr4n2y/node_modules/@ladle/react/lib/cli/cli.js:2
import { program } from "commander";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:892:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11

More about troubleshooting.

Environment

  • OS: OSX 11.6.6
  • @ladle/react": "^1.1.2"
  • pnpm: 7.3.0
@GeorgeNagel GeorgeNagel added the needs triage needs to be reviewed label Jun 21, 2022
@tajo
Copy link
Owner

tajo commented Jun 21, 2022

Is your node version 16+? It needs to support ESM.

Did you just run these?

mkdir my-ladle
cd my-ladle
pnpm init
pnpm add @ladle/react react react-dom
mkdir src
echo "export const World = () => <p>Hey</p>;" > src/hello.stories.tsx
pnpm ladle serve

@tajo tajo added needs reproduction Can't be reproduced and removed needs triage needs to be reviewed labels Jun 21, 2022
@GeorgeNagel
Copy link
Contributor Author

Ah, that's probably it. I'm at v12.13.0. And yes, I ran the above steps.

That was it! Works now after upgrading to v18.4.0. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction Can't be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants