Comments (6)
Hi @mrmckeb
Here's the console log:
info => Loading presets
** packagePathMatch: [
'"$basedir/../../../../node_modules/react-scripts/bin/react-scripts.js"',
'../../../../node_modules/react-scripts/bin/react-scripts.js"',
index: 186,
input: '#!/bin/sh\n' +
`basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")\n` +
'\n' +
'case `uname` in\n' +
' *CYGWIN*) basedir=`cygpath -w "$basedir"`;;\n' +
'esac\n' +
'\n' +
'if [ -x "$basedir/node" ]; then\n' +
' "$basedir/node" "$basedir/../../../../node_modules/react-scripts/bin/react-scripts.js" "$@"\n' +
' ret=$?\n' +
'else \n' +
' node "$basedir/../../../../node_modules/react-scripts/bin/react-scripts.js" "$@"\n' +
' ret=$?\n' +
'fi\n' +
'exit $ret\n',
groups: undefined
]
** scriptsPath: C:\Dev\30_perso\storybook\node_modules\react-scripts\bin\react-scripts.js"
info => Loading presets
I have been using this fix locally since I created the issue. It's not pretty but it works fine:
try {
const content = fs.readFileSync(scriptsBinPath, 'utf8');
const packagePathMatch = content.match(
/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i
);
if (packagePathMatch && packagePathMatch.length > 1) {
const scriptsPath = path.join(cwd, '/node_modules/.bin/', packagePathMatch[1]);
return scriptsPath.replace("\\bin\\react-scripts.js\"", "");
}
} catch (e) {
// NOOP
}
Thank you,
Patrick
from presets.
It was just a small error in the react-scripts package resolution on Windows. I submitted a PR, but if you need to patch it in the meantime.
@storybookjs/presets/packages/preset-create-react-app/helpers/getReactScriptsPath.js
line 16
Before
/"\$basedir[\\/]([^\s]+?[\\/]bin[\\/]react-scripts\.js")/i
After
/"\$basedir[\\/](\S+?)[\\/]bin[\\/]react-scripts\.js"/i
from presets.
Feels like this one is part 2 of #38
from presets.
getReactScriptsPath helper in presets:
https://github.com/storybookjs/presets/blob/master/packages/preset-create-react-app/helpers/getReactScriptsPath.js#L33
looks to be duplicating another getReactScriptsPath: https://github.com/storybookjs/storybook/blob/next/app/react/src/server/cra-config.ts#L53
which seems to handle the Windows case and has some tests. Presets version if statement is excluding Windows from jumping up two directory levels for some reason.
from presets.
Hi @patricklafrance, this was fixed... but seems to have crept back up again - sorry for the slow response, I had some side things to attend to...
Are you able to help with debugging? As I don't have a Windows machine locally. I can install a VM of course, if you can't.
The file that's responsible is this one - https://github.com/storybookjs/presets/blob/master/packages/preset-create-react-app/helpers/getReactScriptsPath.js
It seems that for some reason, the check here is failing:
https://github.com/storybookjs/presets/blob/master/packages/preset-create-react-app/helpers/getReactScriptsPath.js#L8-L38
If you could add some console.logs there, that might help (by editing node_modules
directly).
from presets.
Did this solved? Anyone help...
from presets.
Related Issues (20)
- [Bug] CRA does not print eslint errors to terminal anylonger
- [Bug] CRA preset does not support ES2020 dependencies HOT 2
- Where are the tests for your presets?
- V3.2.0 works but V4.0.0 does not HOT 4
- [Bug] preset-create-react-app: Storybook config dir webpack override breaks default CRA config
- [Bug] Install @storybook/preset-scss with default storybook's bundler 'webpack4' doesn't works HOT 5
- [Bug] CRA5, [email protected] HOT 6
- [Bug] Fails in case of using custom folder structure inside /src
- [Help] Cannot find module '@babel/plugin-proposal-private-property-in-object'
- @storybook/preset-create-react-app 4.0.1 breaks Storybook HOT 4
- [Bug]: macos - Error: Cannot find module '.../node_modules/config/webpack.config' HOT 5
- [Bug] URL from readme does not exist on the website
- [Bug] ENAMETOOLONG on "preset-create-react-app@4" package installation HOT 1
- [Bug] start-storybook breaks when tsconfig.json has comments (preset-create-react-app)
- [Bug] Package dependency HOT 4
- [Bug] Confusing error message when stories folder is outside of src.
- [Bug] cannot run storybook with CRA preset version 4.1.0. HOT 1
- @storybook/react-docgen-typescript-plugin canary dependency
- [Bug] Storybook preset function `getReactScriptsPath` has bug HOT 2
- Missing license file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from presets.