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

[Bug]: npx sb init fails in npm monorepo #22573

Open
leegee opened this issue May 16, 2023 · 4 comments
Open

[Bug]: npx sb init fails in npm monorepo #22573

leegee opened this issue May 16, 2023 · 4 comments
Labels

Comments

@leegee
Copy link

leegee commented May 16, 2023

Describe the bug

lee@20230516-12:14:50:/s/src/xxx/packages/client$ node -v; npm -v
v18.4.0
8.19.0

lee@20230516-12:14:50:/s/src/xxx/packages/client$ npx sb init
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

storybook init - the simplest way to add a Storybook to your project.

(node:11420) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use node --trace-warnings ... to show where the warning was created)
• Detecting project type. ✓
TypeError: Invalid version. Must be a string. Got type "object".
at new SemVer (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules\semver\classes\semver.js:19:13)
at compare (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules\semver\functions\compare.js:3:3)
at Object.gte (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules\semver\functions\gte.js:2:30)
at C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:12:6404
at hasDependency (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:12:3581)
at detectLanguage (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:12:6333)
at installStorybook (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:70:2808)
at async doInitiate (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:79:704)
at async withTelemetry (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\core-server\dist\index.js:35:3422)
at async initiate (C:\Users\xxx\AppData\Local\npm-cache_npx\d28cfb4b54958d89\node_modules@storybook\cli\dist\generate.js:90:108)

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

lee@20230516-12:16:02:/s/src/xxx/packages/client$

To Reproduce

npx sb init

System

npx storybook@latest info
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y

Environment Info:

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 18.4.0 - H:\Program Files\nvm-node-js\node.EXE
    npm: 8.19.0 - H:\Program Files\nvm-node-js\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (113.0.1774.42)

Additional context

No response

@leegee
Copy link
Author

leegee commented May 23, 2023

 npx sb@next init
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y

 storybook init - the simplest way to add a Storybook to your project. 

(node:1840) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 • Detecting project type. ✓
TypeError: Invalid version. Must be a string. Got type "object".
    at new SemVer (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\semver\classes\semver.js:19:13)
    at compare (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\semver\functions\compare.js:3:3)
    at Object.gte (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\semver\functions\gte.js:2:30)
    at C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:12:6408
    at hasDependency (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:12:3585)
    at detectLanguage (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:12:6337)
    at installStorybook (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:79:2809)
    at async doInitiate (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:88:772)
    at async withTelemetry (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\core-server\dist\index.js:35:3620)
    at async initiate (C:\Users\leege\AppData\Local\npm-cache\_npx\eebb2d3a7d26a7f1\node_modules\@storybook\cli\dist\generate.js:99:108)


npx storybook@latest info
Need to install the following packages:
  [email protected]
Ok to proceed? (y) y

Environment Info:

  System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 18.4.0 - H:\Program Files\nvm-node-js\node.EXE
    npm: 8.19.0 - H:\Program Files\nvm-node-js\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (113.0.1774.50)

@leegee
Copy link
Author

leegee commented May 25, 2023

Looks like Storybook can't install into a 'package' within an NPM monrepo, but it will install into the root without issue, and can then be moved without issue (mv stories, .storybook, and npm run scripts).

@leegee leegee changed the title [Bug]: [Bug]: npx sb init fails in npm monorepo May 25, 2023
@shilman
Copy link
Member

shilman commented May 31, 2023

Possibly fixed by #22642

@shilman shilman added monorepos Monorepo support windows npm and removed needs triage labels May 31, 2023
@aanti
Copy link

aanti commented Jun 12, 2023

I faced the same issue in a project made on top of create-vite (react). The problem disapeared when I upgraded TypeScript from 4.x.x to 5.x.x

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

No branches or pull requests

3 participants