Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preset-create-react-app support npm 7 workspaces by default #189

Open
josias-r opened this issue Feb 17, 2021 · 0 comments
Open

preset-create-react-app support npm 7 workspaces by default #189

josias-r opened this issue Feb 17, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@josias-r
Copy link

Describe the bug

We set-up npm7 workspaces for our monorepo with a storybook installation using preset-create-react-app. The preset has troubles finding react-scripts and by default throws the error: ERR! Failed to resolve a `react-scripts` package.

I found the following workaround, which I think should be included by default:

const path = require("path");

module.exports = {
  stories: ["../src/**/*.stories.@(js|ts|tsx|mdx)"],
  addons: [
    {
      name: "@storybook/preset-create-react-app",
      options: {
        scriptsPackageName: path.resolve("../node_modules/react-scripts"), // add this line so react-scripts is found
      },
    },
    "@storybook/addon-essentials",
  ],
};

Steps to reproduce the behavior

Monorepo set-up using npm 7 with a storybook installation as a sub package will cause this error.

Expected behavior

React-scripts should not have troubles being located by default.

Screenshots and/or logs

Screenshot 2021-02-17 at 12 13 14

Environment

  • OS: MacOS
  • Node.js version: [e.g. v15.8.0]
  • NPM version: [e.g. 7.5.4]

Additional context

Add any other context about the problem here.

@josias-r josias-r added the bug Something isn't working label Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant