Open unional opened 2 years ago
I can repro it with just pnpm
This is similar to: https://github.com/storybookjs/storybook/issues/10668
This works fine for me on WIndows but see the error above in a Linux VM and Bitbucket pipeline using Docker. The source of the issue is definitely that getReactScriptsPath
utility file.
I tried to modify the .storybook/main.js
from:
module.exports = {
addons: [
'@storybook/preset-create-react-app'
]
};
to:
module.exports = {
addons: [
{
name: '@storybook/preset-create-react-app'
options: {
scriptsPackageName: 'react-scripts'
}
}
]
};
And it is works for me.
similar deal for me, where it works fine on windows, but not on mac. We have our own fork of react-scripts, but not storybook. About to try @Asuka109 's fix. seems to have worked.
Describe the bug
Unable to start storybook in MacOS when using with
rush
andpnpm
Steps to reproduce the behavior
Repro:
https://github.com/cyberuni/storybook-preset-mac-os/tree/cmd
You need to install
rush
for the repro (npm i -g @microsoft/rush
andcorepack enable
)Expected behavior
storybook starts
Screenshots and/or logs
Environment
Additional context
The problem is caused by this code:
https://github.com/storybookjs/presets/blob/master/packages/preset-create-react-app/src/helpers/getReactScriptsPath.ts#L37-L39
scriptsBinPath
is something like.../node_modules/.bin/react-scripts
so going up two levels becomes.../node_modules
Changing it to
join(resolvedBinPath, '..', '..', 'react-scripts')
or removing that code will fix the issue.The next block gets the correct path:
What's the use case for that code? Can it be adjusted or removed?