GithubHelp home page GithubHelp logo

Comments (6)

patricklafrance avatar patricklafrance commented on September 18, 2024 1

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.

mattmaduzia avatar mattmaduzia commented on September 18, 2024 1

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.

justrhysism avatar justrhysism commented on September 18, 2024

Feels like this one is part 2 of #38

from presets.

LobsterBandit avatar LobsterBandit commented on September 18, 2024

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.

mrmckeb avatar mrmckeb commented on September 18, 2024

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.

viet-nv avatar viet-nv commented on September 18, 2024

Did this solved? Anyone help...

from presets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.