Describe the bug
The packages that are set up using sb init are being installed via npm despite Yarn presence.
To Reproduce
Steps to reproduce the behavior:
@storybook/cli globally via Yarnsb init on an applicable projectExpected behavior
Yarn could have installed the packages instead of npm.
System:
System:
OS: Windows 10 10.0.17134
CPU: (4) x64 Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz
Binaries:
Node: 12.10.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.19.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
Additional Context:
Chocolatey version is 0.10.15 (output of choco --version)
The sample project had Lerna and Yarn workspaces integrated. The command was run in a Yarn workspaces.
@Temoto-kun
Does your application have yarn.lock?
Storybook CLI uses Yarn only when ( there is yarn.lock file on the installation directory OR npm command is unavailable) AND yarn command is available. https://github.com/storybookjs/storybook/pull/3453#issuecomment-382891993
// pseudo code
useYarn = (has('yarn.lock') || !isAvailable('npm')) && isAvailable('yarn')
By the way, we should change the doc. It's quite confusable 馃槙
@pocka I edited my report to include that the command was run in a Yarn workspace.
From the directory I ran the command on, there was no yarn.lock present, however there existed a yarn.lock file in a parent directory serving as the Yarn workspaces root. In my case, I ran sb init in /project-dir/packages/package-foo, while the yarn.lock was present in /project-dir.
Yowza!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-beta.21 containing PR #9104 that references this issue. Upgrade today to try it out!
You can find this prerelease on the @next NPM tag.
Most helpful comment
@pocka I edited my report to include that the command was run in a Yarn workspace.
From the directory I ran the command on, there was no
yarn.lockpresent, however there existed ayarn.lockfile in a parent directory serving as the Yarn workspaces root. In my case, I ransb initin/project-dir/packages/package-foo, while theyarn.lockwas present in/project-dir.