storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Bug]: Error installing storybook in monorepo

Open osvaldokalvaitir opened this issue 1 year ago • 14 comments

Describe the bug

Error installing storybook in monorepo

Node - v18.13.0

NPM - 9.3.1

When running the command:

npx storybook init

or

npx storybook init --builder @storybook/builder-vite --type react --use-npm

this error occurs:

errro

To Reproduce

No response

System

No response

Additional context

No response

osvaldokalvaitir avatar Jan 22 '23 18:01 osvaldokalvaitir

Same issues with node v19.3.0. I tried to install storybook with vuejs 3 in a separate repository to import components from different other packages in the same workspace.

Tested with the latest storybook 6.5 as well as 7.0.0-beta.31.

cngJo avatar Jan 22 '23 19:01 cngJo

I was able to perform the process on Node v16.15.0

osvaldokalvaitir avatar Jan 23 '23 18:01 osvaldokalvaitir

What have you done to get this working?

I have the following NPM workspace setup for my monorepo:

. 
./assets/apps/mc-storybook
./asstes/apps/mc-web
./assets/packages/component-library
./assets/packages/other-lib

where both assets/packages/* and assets/apps/* are defined as workspaces:

"workspaces": [
  "assets/packages/*",
  "assets/apps/*"
]

I've then create a new vuejs3 app in the ./assets/apps/storybook directory and ran npx storybook init --builder @storybook/builder-vite --type vue3 --use-npm which crashed with the error you originally posted.

Looking at the debug logs, this seems to be related to storybook calling the command:config command which is not supported by workspace:

Quote form the docs:

Note: This command is unaware of workspaces.

Are you doing sth. different than what I've described?


Complete npm log file (with a censored path)
0 verbose cli /usr/local/Cellar/node/19.3.0/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 info found workspace root at /Users/johannes/Programming/organisation/SaaS/project/project
10 timing config:load:file:/Users/johannes/Programming/organisation/SaaS/project/project/.npmrc Completed in 0ms
11 timing config:load:project Completed in 10ms
12 timing config:load:file:/Users/johannes/.npmrc Completed in 1ms
13 timing config:load:user Completed in 1ms
14 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
15 timing config:load:global Completed in 0ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 18ms
18 timing npm:load:configload Completed in 18ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm config get legacy-peer-deps
22 verbose argv "config" "get" "legacy-peer-deps" "--location" "project"
23 timing npm:load:setTitle Completed in 2ms
24 timing config:load:flatten Completed in 2ms
25 timing npm:load:display Completed in 4ms
26 verbose logfile logs-max:10 dir:/Users/johannes/.npm/_logs/2023-01-23T19_51_39_486Z-
27 verbose logfile /Users/johannes/.npm/_logs/2023-01-23T19_51_39_486Z-debug-0.log
28 timing npm:load:logFile Completed in 13ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 38ms
32 timing command:config Completed in 2ms
33 verbose stack Error: This command does not support workspaces.
33 verbose stack     at Config.cmdExec (/usr/local/lib/node_modules/npm/lib/base-command.js:123:29)
33 verbose stack     at Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:154:20)
33 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:134:5)
34 verbose cwd /Users/johannes/Programming/organisation/SaaS/project/project/assets/apps/mc-storybook
35 verbose Darwin 22.2.0
36 verbose node v19.3.0
37 verbose npm  v9.3.1
38 error code ENOWORKSPACES
39 error This command does not support workspaces.
40 verbose exit 1
41 timing npm Completed in 50ms
42 verbose code 1
43 error A complete log of this run can be found in:
43 error     /Users/johannes/.npm/_logs/2023-01-23T19_51_39_486Z-debug-0.log

cngJo avatar Jan 23 '23 20:01 cngJo

What have you done to get this working?

I have the following NPM workspace setup for my monorepo:

. 
./assets/apps/mc-storybook
./asstes/apps/mc-web
./assets/packages/component-library
./assets/packages/other-lib

where both assets/packages/* and assets/apps/* are defined as workspaces:

"workspaces": [
  "assets/packages/*",
  "assets/apps/*"
]

I've then create a new vuejs3 app in the ./assets/apps/storybook directory and ran npx storybook init --builder @storybook/builder-vite --type vue3 --use-npm which crashed with the error you originally posted.

Looking at the debug logs, this seems to be related to storybook calling the command:config command which is not supported by workspace:

Quote form the docs:

Note: This command is unaware of workspaces.

Are you doing sth. different than what I've described?

Complete npm log file (with a censored path)

I only changed the version of Node.js

My package.json:

{
  "private": true,
  "workspaces": [
    "packages/*"
  ]
}

osvaldokalvaitir avatar Jan 23 '23 20:01 osvaldokalvaitir

I can normal install this lib, always when i want use sb i must fixed 10 errors

wtf?

same error.... i think is npm version

ghost avatar Jan 29 '23 07:01 ghost

Hit this issue also with Node v19.6.0

It worked correctly after downgrading to Node v16.19.0

danleyden avatar Feb 08 '23 14:02 danleyden

Also hit this issue, with Node v19.6.0, 19.5.0, 18.14.0

Downgrading to Node v16.19.0 resolved the problem but is definitely not ideal

sgpicone avatar Feb 08 '23 18:02 sgpicone

npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2023-02-24T14_41_14_696Z-debug-0.log

Same. With npm v18

clearly-outsane avatar Feb 24 '23 14:02 clearly-outsane

getting the same error, following the turborepo guide at https://turbo.build/repo/docs/handbook/tools/storybook, on node 16.19.1

AFusco avatar Feb 27 '23 17:02 AFusco

An error occurred while installing dependencies. npm ERR! code ENOWORKSPACES npm ERR! This command does not support workspaces.

Same error with Node v18.14.2 and npm 9.6.0

idoialongan avatar Mar 07 '23 11:03 idoialongan

Think this is a turborepo / npm bug, not storybook.

I have the same issue, and i dont have storybook installed.

npm 9.50 turbo 1.83 node v18.50.0

davecarlson avatar Mar 08 '23 20:03 davecarlson

I am getting the same error while using turborepo with npm and nextjs. My dependencies are installing but when I start the dev server I see the following.

image
0 verbose cli /Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/bin/node /Users/jpetrillo/Library/Caches/fnm_multishells/12304_1678801214413/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:/Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/lib/node_modules/npm/npmrc Completed in 0ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 0ms
8 timing config:load:env Completed in 1ms
9 info found workspace root at /Users/jpetrillo/Documents/Projects/with-npm
10 timing config:load:file:/Users/jpetrillo/Documents/Projects/with-npm/.npmrc Completed in 0ms
11 timing config:load:project Completed in 3ms
12 timing config:load:file:/Users/jpetrillo/.npmrc Completed in 0ms
13 timing config:load:user Completed in 0ms
14 timing config:load:file:/Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/etc/npmrc Completed in 0ms
15 timing config:load:global Completed in 0ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 6ms
18 timing npm:load:configload Completed in 6ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm config get registry
22 verbose argv "config" "get" "registry"
23 timing npm:load:setTitle Completed in 5ms
24 timing config:load:flatten Completed in 2ms
25 timing npm:load:display Completed in 2ms
26 verbose logfile logs-max:10 dir:/Users/jpetrillo/.npm/_logs/2023-03-14T13_40_45_696Z-
27 verbose logfile /Users/jpetrillo/.npm/_logs/2023-03-14T13_40_45_696Z-debug-0.log
28 timing npm:load:logFile Completed in 2ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 16ms
32 timing command:config Completed in 1ms
33 verbose stack Error: This command does not support workspaces.
33 verbose stack     at Config.cmdExec (/Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/lib/node_modules/npm/lib/base-command.js:123:29)
33 verbose stack     at Npm.exec (/Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/lib/node_modules/npm/lib/npm.js:154:20)
33 verbose stack     at async module.exports (/Users/jpetrillo/Library/Application Support/fnm/node-versions/v18.15.0/installation/lib/node_modules/npm/lib/cli.js:134:5)
34 verbose cwd /Users/jpetrillo/Documents/Projects/with-npm/apps/latest
35 verbose Darwin 22.2.0
36 verbose node v18.15.0
37 verbose npm  v9.6.1
38 error code ENOWORKSPACES
39 error This command does not support workspaces.
40 verbose exit 1
41 timing npm Completed in 22ms
42 verbose code 1
43 error A complete log of this run can be found in:
43 error     /Users/jpetrillo/.npm/_logs/2023-03-14T13_40_45_696Z-debug-0.log

node 18.15.0 npm 9.6.1 turborepo 1.8.3 nextjs 13.2.4

joepetrillo avatar Mar 13 '23 18:03 joepetrillo

Having the same issue I see it was tagged with "has workaround", I hope the workaround is not "use a no longer manteined version of node" cause I don't see any

RodrigoNovais avatar Sep 18 '23 04:09 RodrigoNovais

I also faced this issue with Turborepo and React. So, it remains. I want to contribute to fixing it if contributors think it makes sense.

node v18.19.0
npm v10.2.3
turbo v1.11.3

dolgachio avatar Feb 19 '24 11:02 dolgachio

FYI same error in nextjs. https://github.com/vercel/next.js/issues/47121#issuecomment-1499044345

I hope it may help

aewshyae avatar Feb 20 '24 02:02 aewshyae

Can someone provide a minimal reproduction? https://storybook.new

valentinpalkovic avatar Feb 20 '24 08:02 valentinpalkovic

@valentinpalkovic thank you for your response, so to reproduce it, do you need some examples on StackBlitz or some similar platform?

dolgachio avatar Feb 20 '24 17:02 dolgachio

You can also just provide a GitHub Repo with the minimal reproduction.

valentinpalkovic avatar Feb 20 '24 17:02 valentinpalkovic

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[bot] avatar Mar 13 '24 01:03 github-actions[bot]

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[bot] avatar Mar 21 '24 01:03 github-actions[bot]

not yet resolved

osvaldokalvaitir avatar Mar 21 '24 11:03 osvaldokalvaitir