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

Cannot init in a new project #26553

Open
pavi2410 opened this issue Mar 18, 2024 · 52 comments
Open

Cannot init in a new project #26553

pavi2410 opened this issue Mar 18, 2024 · 52 comments

Comments

@pavi2410
Copy link

pavi2410 commented Mar 18, 2024

Describe the bug

I am trying to install Storybook in a new project. But when I run npx storybook@latest init, it says "Error: Unable to find versions of @storybook/cli using npm"

To Reproduce

Run npx storybook@latest init

System

Storybook Environment Info:
 
   System:
     OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
     CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
     Shell: 5.1.16 - /bin/bash
   Browsers:
     Chrome: 122.0.6261.128

Additional context

 Error: Unable to find versions of @storybook/cli using npm
     at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/6fe9a9991b157df1/node_modules/@storybook/core-common/dist/index.js:37:639)
     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
     at async doInitiate (/home/pavitra/.npm/_npx/6fe9a9991b157df1/node_modules/@storybook/cli/dist/generate.js:146:997)
     at async withTelemetry (/home/pavitra/.npm/_npx/6fe9a9991b157df1/node_modules/@storybook/core-server/dist/index.js:28:3579)
     at async initiate (/home/pavitra/.npm/_npx/6fe9a9991b157df1/node_modules/@storybook/cli/dist/generate.js:180:250)
@Kenzo-Wada
Copy link

I think you should npm install @storybook/cli first.

@pavi2410
Copy link
Author

I think you should npm install @storybook/cli first.

npx installs the CLI if it isn't already available. Also, nowhere in the getting started guide it is mentioned that the CLI needs to be installed separately before.

@shilman
Copy link
Member

shilman commented Mar 18, 2024

Have you tried clearing your npm cache and running again?

@pavitra-infocusp
Copy link

Have you tried clearing your npm cache and running again?

Yes!

❯ npm cache clean --force
npm WARN using --force Recommended protections disabled.

❯ npx storybook@latest init
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:146:997)
    at async withTelemetry (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-server/dist/index.js:28:3579)
    at async initiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:180:250)

@vanessayuenn
Copy link
Contributor

Out of curiosity, does this happen if you try to run npx storybook@latest init in an empty directory?

@pavi2410
Copy link
Author

Out of curiosity, does this happen if you try to run npx storybook@latest init in an empty directory?

Yes, I even tried that earlier.

@vanessayuenn
Copy link
Contributor

This is really strange. Does this command npm info @storybook/cli version --json execute successfully?

@pavitra-infocusp
Copy link

This is really strange. Does this command npm info @storybook/cli version --json execute successfully?

Yes, it does

❯ npm info @storybook/cli version --json
"8.0.2"

@pavitra-infocusp
Copy link

Tried it again with 8.0.2; didn't work

❯ npx storybook@latest init
Need to install the following packages:
storybook@8.0.2
Ok to proceed? (y) y
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:146:997)
    at async withTelemetry (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core-server/dist/index.js:28:3579)
    at async initiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/cli/dist/generate.js:180:250)

Copy link
Contributor

Hi there! Thank you for opening this issue, but it has been marked as stale because we need more information to move forward. Could you please provide us with the requested reproduction or additional information that could help us better understand the problem? We'd love to resolve this issue, but we can't do it without your help!

@github-actions github-actions bot added the Stale label Apr 11, 2024
Copy link
Contributor

I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
@pavitra-infocusp
Copy link

pavitra-infocusp commented Apr 29, 2024

Thought I should give it a try again and ran into this issue again.

This time I tried to debug what's the case. It seems that the execCommand function at this line returns an empty string. The command execution went well. The console logs below proves that.

❯ npx storybook init
"8.0.9"                        <--- stdio inherit passed to execCommand
{ commandResult: '' }          <--- It should have been "8.0.9"
Unexpected end of JSON input   <--- json parsing on empty string
Error: Unable to find versions of @storybook/cli using npm

@pavitra-infocusp
Copy link

@shilman Can you please reopen this issue?

@pavitra-infocusp
Copy link

So, I went deep further, and learnt that the stdout from the command is undefined, which is very strange as neither stderr is defined.

{
  commandResult: {
    command: 'npm info @storybook/cli version --json',
    escapedCommand: 'npm info "@storybook/cli" version --json',
    exitCode: 0,
    stdout: undefined,
    stderr: undefined,
    all: undefined,
    failed: false,
    timedOut: false,
    isCanceled: false,
    killed: false
  }
}

@pavitra-infocusp
Copy link

looks like something is wrong with execa.

import {execa} from 'execa';

const commandResult = await execa('npm', ['info', '@storybook/cli', 'version', '--json']);
console.log(commandResult);
❯ node testexec.js 
{
  command: 'npm info @storybook/cli version --json',
  escapedCommand: 'npm info "@storybook/cli" version --json',
  exitCode: 0,
  stdout: '',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
}

@shilman
Copy link
Member

shilman commented Apr 29, 2024

@pavitra-infocusp re-opened. so i guess we wait for the resolution in execa? thanks so much for digging in on this. 🙏

@shilman shilman removed the Stale label Apr 29, 2024
@ehmicky
Copy link

ehmicky commented Apr 29, 2024

👋 I am Execa's co-maintainer.

From the look of it, I do not think there is a bug with Execa there, but the issue at sindresorhus/execa#995 can track this.

In terms of calling Execa in Storybook, I would recommend replacing execaCommand() with execa() instead. execaCommand() is intended for REPL, not programmatic usage. This documentation explains it. The current usage in Storybook might not be escaping arguments properly due to this.

More details: the shell: true option executes the command and its argument as a single string, with the shell interpreting it. The execaCommand() splits the input string into a command and an arguments array using spaces as delimiters. And Storybook joins the command and the arguments array into a string. So right now, this looks this:

runCommand({command: 'npm', arguments: ['install', 'example with space']});
-> execaCommand('npm install example with space', {shell: true});
-> execa('npm', ['install', 'example with space'], {shell: true});
-> child_process.spawn('npm', ['install', 'example with space'], {shell: true});
-> (on Unix) bash -c "npm install example with space"
   (on Windows) cmd /d /s /c "npm install example with space"

As you can see, the execaCommand()'s parsing is not really needed there, and execa() could be called directly instead.

The shell: true option is usually problematic, as it prevents proper escaping (as you see from the above example with spaces, which end up not being quoted), which could look to command injection. However, npm and yarn are weird, and might requires being running in a shell, depending on your case.

const commandResult = await execaCommand([command, ...args].join(' '), {
cwd: cwd ?? this.cwd,
stdio: stdio ?? 'pipe',
encoding: 'utf-8',
shell: true,
cleanup: true,
env,
...execaOptions,
});

@shilman
Copy link
Member

shilman commented Apr 29, 2024

@ehmicky Thanks so much for helping out here (and for maintaining Execa -- you rock!!!). I'm not sure whether we are on Execa v5 out of laziness or there's something specific that's holding us back. I'll check with the team and we'll try to get it upgraded. Hopefully @pavitra-infocusp or one of the other folks who experienced this issue can confirm the fix. 🙏

@bcraun
Copy link

bcraun commented Jun 13, 2024

@lfrancke both are installed on my system.

@anguspiv
Copy link

anguspiv commented Jun 14, 2024

I wanted to add a comment for those who run into this issue, and unblock themselves potentially.
I was attempting to add storybook to this project/repo.

Storybook Environment Info:
System:
OS: macOs Sanoma 14.5 (23F79)
CPU: 2.4 GHz 8-Core Intel Core i9
Shell: zsh 5.9 (x86_64-apple-darwin23.0)
Node: v20.11.0
nvm: 0.38.0
Browsers:
Arc: 1.47.1 (50893) / Chromium Engine Version 126.0.6478.57

I downgraded node with nvm to v18.17.0, and was able to successfully run the command. pnpm dlx storybook@latest init.

I did see the error reporting an issue with using remix, which is expected.

@ndelangen
Copy link
Member

@ndelangen [repo]. Fresh ASP.NET Core React + Vite .NET 8 template solution...console output below. Thanks for the help.

ReactViteApp

I was able to run npx storybook@latest init on your project just fine.

The storybook then failed to start with this error:

╭──────────────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Storybook was successfully installed in your project! 🎉                   │
│   To run Storybook manually, run npm run storybook. CTRL+C to stop.          │
│                                                                              │
│   Wanna know more about Storybook? Check out https://storybook.js.org/       │
│   Having trouble or want to chat? Join us at https://discord.gg/storybook/   │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Running Storybook

> reactviteapp.client@0.0.0 storybook
> storybook dev -p 6006 --initial-path=/onboarding --quiet

@storybook/cli v8.1.10

info => Starting manager..
info => Starting preview..
failed to load config from /Users/me/Projects/Storybook/repros/storybook-install-repro/ReactViteApp/reactviteapp.client/vite.config.ts
=> Failed to build the preview
Error: Could not create certificate.
    at <anonymous> (./vite.config.ts:29:15)
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
    at async loadConfigFromBundledFile (file://./node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:69964:21)
    at async loadConfigFromFile (file://./node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:69817:28)
    at async commonConfig (./node_modules/@storybook/builder-vite/dist/index.js:55:6402)
    at async createViteServer (./node_modules/@storybook/builder-vite/dist/index.js:55:11515)
    at async Module.start (./node_modules/@storybook/builder-vite/dist/index.js:58:1102)
    at async storybookDevServer (./node_modules/@storybook/core-server/dist/index.js:40:7719)
    at async buildOrThrow (./node_modules/@storybook/core-server/dist/index.js:36:1975)

WARN Broken build, fix the error above.

@bcraun
Copy link

bcraun commented Jun 19, 2024

@ndelangen my guess is that you don't have .net 8 installed which is required.

if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
    if (0 !== child_process.spawnSync('dotnet', [
        'dev-certs',
        'https',
        '--export-path',
        certFilePath,
        '--format',
        'Pem',
        '--no-password',
    ], { stdio: 'inherit', }).status) {
        throw new Error("Could not create certificate.");
    }
}

Irrespective, it sounds environment related. Is there any more info I can provide to help identify dependency issues?

@iamandrewluca
Copy link
Contributor

In my case, this issue disappeared after a while, and the upgrade/new install works fine now. I think it was somehow fixed in a recent update 🤔

@yannbf
Copy link
Member

yannbf commented Jun 25, 2024

Hey everyone, this error seems to be related to a bug in a specific NPM versions (see this confirmation), plus our error handling that didn't really provide much information.

In Storybook 8.2 the error message will be updated to contain the full error to assist us in fixing this. In case there is something related other than the NPM bug, we will take a look and fix.

If you are still experiencing this issue, please:

  • Check which version of Node and NPM you are using: node --version + npm --version (write down to share here).
  • If you are using npm 10.8.0, upgrade to another version if you can
  • If your issue still happens after upgrading, share as much information as you can here

@jeffijoe
Copy link

jeffijoe commented Jun 25, 2024

I've been trying with pnpm and get the same error.

Node: 20.12.1
PNPM: 9.4.0

❯ pnpm dlx storybook@latest init
Error: Unable to find versions of @storybook/cli using pnpm
    at PNPMProxy.runGetVersions (/Users/jeff.hansen/Library/Caches/pnpm/dlx/unbkmcv47bmd3k4heaisxlpgg4/1904fecd90e-4f0e/node_modules/.pnpm/@storybook+core-common@8.1.10_prettier@3.3.2/node_modules/@storybook/core-common/dist/index.js:39:638)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/Users/jeff.hansen/Library/Caches/pnpm/dlx/unbkmcv47bmd3k4heaisxlpgg4/1904fecd90e-4f0e/node_modules/.pnpm/@storybook+cli@8.1.10_@babel+preset-env@7.24.7_@babel+core@7.24.7__react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@storybook/cli/dist/generate.js:146:992)
    at async withTelemetry (/Users/jeff.hansen/Library/Caches/pnpm/dlx/unbkmcv47bmd3k4heaisxlpgg4/1904fecd90e-4f0e/node_modules/.pnpm/@storybook+core-server@8.1.10_prettier@3.3.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@storybook/core-server/dist/index.js:40:3599)
    at async initiate (/Users/jeff.hansen/Library/Caches/pnpm/dlx/unbkmcv47bmd3k4heaisxlpgg4/1904fecd90e-4f0e/node_modules/.pnpm/@storybook+cli@8.1.10_@babel+preset-env@7.24.7_@babel+core@7.24.7__react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@storybook/cli/dist/generate.js:180:214)

EDIT: Despite not even using npm, upgrading to 10.8.1 made it work.

@bcraun
Copy link

bcraun commented Jun 25, 2024

Confirming upgrade to npm 10.8.1 resolved the issue for me, as well. Thank you @yannbf!

$ npm i -g npm@10.8.1
$ npx storybook@latest init

@anguspiv
Copy link

anguspiv commented Jun 26, 2024

Confirming, upgrading npm to 10.8.1 resolved the issue when using pnpm.

> nvm install 20
> node --version
v20.15.0
>  npm --version
10.8.1
> pnpm dlx storybook@latest init

@lb-
Copy link

lb- commented Jun 26, 2024

Updating npm also fixed the issue for me. Thank you team.

@vanessayuenn
Copy link
Contributor

Looks like this has been resolved then! Thanks everyone for confirming the fix.

@pavitra-infocusp
Copy link

pavitra-infocusp commented Jul 2, 2024

I don't know why this still doesn't work for me :(

I just started a new React + Vite project and I am still not able to init Storybook.

❯ npx storybook@latest init
Need to install the following packages:
storybook@8.1.11
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
(node:143516) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/76a56df03ee7b47f/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/76a56df03ee7b47f/node_modules/@storybook/cli/dist/generate.js:146:992)
    at async withTelemetry (/home/pavitra/.npm/_npx/76a56df03ee7b47f/node_modules/@storybook/core-server/dist/index.js:40:3599)
    at async initiate (/home/pavitra/.npm/_npx/76a56df03ee7b47f/node_modules/@storybook/cli/dist/generate.js:180:214)
❯ npx storybook@latest -V
8.1.11

❯ node -v
v22.1.0

❯ npm -v
10.8.1

@bcraun
Copy link

bcraun commented Jul 2, 2024

@pavitra-infocusp , last week Storybook 8.1.10 was latest, but other than that my npm and node versions are the same as yours. It's a stretch, but have you tried installing 8.1.10?

@pavitra-infocusp
Copy link

Nope, 8.1.10 doesn't work either :(

❯ npx storybook@8.1.10 init
Need to install the following packages:
storybook@8.1.10
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
(node:192751) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/4862a5c4b3784c7e/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/4862a5c4b3784c7e/node_modules/@storybook/cli/dist/generate.js:146:992)
    at async withTelemetry (/home/pavitra/.npm/_npx/4862a5c4b3784c7e/node_modules/@storybook/core-server/dist/index.js:40:3599)
    at async initiate (/home/pavitra/.npm/_npx/4862a5c4b3784c7e/node_modules/@storybook/cli/dist/generate.js:180:214)

@pavitra-infocusp
Copy link

I tried using the next tag, resulting in the same error.

❯ npx storybook@next init
Need to install the following packages:
storybook@8.2.0-alpha.10
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
(node:212042) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: Unable to find versions of @storybook/cli using npm
    at NPMProxy.runGetVersions (/home/pavitra/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/core-common/dist/index.js:37:639)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/cli/dist/generate.js:146:992)
    at async withTelemetry (/home/pavitra/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/core-server/dist/index.js:40:3599)
    at async initiate (/home/pavitra/.npm/_npx/eb8bf615e50a412a/node_modules/@storybook/cli/dist/generate.js:180:214)

@pavitra-infocusp
Copy link

pavitra-infocusp commented Jul 11, 2024

I just tried again with 8.2.1 and got a fancy error message this time. No difference in the error though.

❯ npx storybook@latest init
Need to install the following packages:
storybook@8.2.1
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
SB_CLI_0001 (FindPackageVersionsError): Unable to find versions of "storybook" using NPM
Reason: Error: Command failed with exit code 1: npm info storybook version --json
    at QJ.runGetVersions (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:153538:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:157:982)
    at async withTelemetry (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/core-server/index.cjs:188662:12)
    at async initiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:191:214) {
  category: 'CLI',
  code: 1,
  data: {
    error: Error: Command failed with exit code 1: npm info storybook version --json
        at makeError (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:152294:67)
        at handlePromise (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:152914:15)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async QJ.executeCommand (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:153365:15)
        at async QJ.runGetVersions (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/common/index.cjs:153530:15)
        at async doInitiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:157:982)
        at async withTelemetry (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/@storybook/core/dist/core-server/index.cjs:188662:12)
        at async initiate (/home/pavitra/.npm/_npx/bc7e1e37fcb46ffc/node_modules/storybook/dist/generate.cjs:191:214) {
      shortMessage: 'Command failed with exit code 1: npm info storybook version --json',
      command: 'npm info storybook version --json',
      escapedCommand: 'npm info storybook version --json',
      exitCode: 1,
      signal: undefined,
      signalDescription: undefined,
      stdout: '',
      stderr: '',
      cwd: '/home/pavitra/Projects/<redacted>',
      failed: true,
      timedOut: false,
      isCanceled: false,
      killed: false
    },
    packageManager: 'NPM',
    packageName: 'storybook'
  },
  documentation: false,
  fromStorybook: true
}

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

@pavitra-infocusp
Copy link

I'll try to fix and send a PR.

@edmacovaz
Copy link

Still getting the error on

Node: 22.0.9
npm: 10.8.3
Storybook: 8.3.3

SB_CLI_0001 (FindPackageVersionsError): Unable to find versions of "storybook" using NPM
Reason: SyntaxError: Unexpected non-whitespace character after JSON at position 3
    at _F.runGetVersions (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/common/index.cjs:142627:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:85:995)
    at async withTelemetry (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
    at async initiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:119:214) {
  data: {
    error: SyntaxError: Unexpected non-whitespace character after JSON at position 3
        at JSON.parse (<anonymous>)
        at _F.runGetVersions (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/common/index.cjs:142622:20)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async doInitiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:85:995)
        at async withTelemetry (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
        at async initiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:119:214),
    packageManager: 'NPM',
    packageName: 'storybook'
  },
  fromStorybook: true,
  category: 'CLI',
  documentation: false,
  code: 1
}

@rseverinop
Copy link

rseverinop commented Sep 29, 2024

Still getting the error on

Node: 22.0.9 npm: 10.8.3 Storybook: 8.3.3

SB_CLI_0001 (FindPackageVersionsError): Unable to find versions of "storybook" using NPM
Reason: SyntaxError: Unexpected non-whitespace character after JSON at position 3
    at _F.runGetVersions (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/common/index.cjs:142627:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async doInitiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:85:995)
    at async withTelemetry (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
    at async initiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:119:214) {
  data: {
    error: SyntaxError: Unexpected non-whitespace character after JSON at position 3
        at JSON.parse (<anonymous>)
        at _F.runGetVersions (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/common/index.cjs:142622:20)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async doInitiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:85:995)
        at async withTelemetry (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
        at async initiate (/Users/edmacovaz/.npm/_npx/3158839f1cfed546/node_modules/create-storybook/dist/bin/index.cjs:119:214),
    packageManager: 'NPM',
    packageName: 'storybook'
  },
  fromStorybook: true,
  category: 'CLI',
  documentation: false,
  code: 1
}

I have the same problem, and I can't find any resourse to fix this problem.

node version: v20.17
npm: 10.8.3
Storybook: 8.3.3

@abolfazlcodes
Copy link

Has anyone found a solution?

@acastle-optimist
Copy link

also getting this issue, again.
node 21..5.0
npm 10.8.1

@JReinhold JReinhold reopened this Oct 22, 2024
@JReinhold
Copy link
Contributor

@vanessayuenn appears that this is still an issue for some users, even on newer versions.

@ghengeveld
Copy link
Member

This might be resolved by upgrading Execa and replacing execaCommand with execa, since execaCommand is deprecated and should generally be avoided.

@johnmanko
Copy link

johnmanko commented Oct 25, 2024

In an empty directory, npx storybook@latest init with Next.js (TS) fails to install (it just sits there).

❯ npx storybook@latest init
╭──────────────────────────────────────────────────────╮
│                                                      │
│   Adding Storybook version 8.3.6 to your project..   │
│                                                      │
╰──────────────────────────────────────────────────────╯
╔ 🔎 Empty directory detected ══════════════════════════════════════════════════════════════════════╗
║                                                                                                   ║
║   Would you like to generate a new project from the following list?                               ║
║                                                                                                   ║
║   Note:                                                                                           ║
║   Storybook supports many more frameworks and bundlers than listed below. If you don't see your   ║
║   preferred setup, you can still generate a project then rerun this command to add Storybook.     ║
║                                                                                                   ║
║   Press ^C at any time to quit.                                                                   ║
║                                                                                                   ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════════╝

✔ Choose a project template › Next.js (TS)

Creating a new "Next.js (TS)" project with npm...

I end up having to kill the process. When I do, there are only three files created in .cache/storybook/default/dev-server.

Choosing React + Vite (TS) completes:

❯ npx storybook@latest init
╭──────────────────────────────────────────────────────╮
│                                                      │
│   Adding Storybook version 8.3.6 to your project..   │
│                                                      │
╰──────────────────────────────────────────────────────╯
╔ 🔎 Empty directory detected ══════════════════════════════════════════════════════════════════════╗
║                                                                                                   ║
║   Would you like to generate a new project from the following list?                               ║
║                                                                                                   ║
║   Note:                                                                                           ║
║   Storybook supports many more frameworks and bundlers than listed below. If you don't see your   ║
║   preferred setup, you can still generate a project then rerun this command to add Storybook.     ║
║                                                                                                   ║
║   Press ^C at any time to quit.                                                                   ║
║                                                                                                   ║
╚═══════════════════════════════════════════════════════════════════════════════════════════════════╝

✔ Choose a project template › React + Vite (TS)

Creating a new "React + Vite (TS)" project with npm...

╔ ✅ Success! ═══════════════════════════════════════════════════╗
║                                                                ║
║   "React + Vite (TS)" project with npm created successfully!   ║
║                                                                ║
║   Continuing with Storybook installation...                    ║
║                                                                ║
╚════════════════════════════════════════════════════════════════╝

 • Detecting project type
attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

. ✓
Installing dependencies...


added 182 packages, and audited 183 packages in 16s

41 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
 • Adding Storybook support to your "React" app • Detected Vite project. Setting builder to Vite. ✓

  ✔ Getting the correct version of 10 packages
    Configuring eslint-plugin-storybook in your package.json
  ✔ Installing Storybook dependencies
. ✓
Installing dependencies...


up to date, audited 456 packages in 777ms

124 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
╭──────────────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Storybook was successfully installed in your project! 🎉                   │
│   To run Storybook manually, run npm run storybook. CTRL+C to stop.          │
│                                                                              │
│   Wanna know more about Storybook? Check out https://storybook.js.org/       │
│   Having trouble or want to chat? Join us at https://discord.gg/storybook/   │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Running Storybook

.....

❯ zsh --version
zsh --version
zsh 5.9 (x86_64-ubuntu-linux-gnu)

❯ uname -a
Linux xxxxxx 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

❯ node -v
v22.9.0

❯ npm -v
10.8.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Empathy Backlog
Development

No branches or pull requests