Module not found: Error: You attempted to import /node_modules/react-refresh/runtime.js which falls outside of the project src/ directory

See original GitHub issue

Describe the bug related to the new RCA 5 using @storybook/react: 6.4.9 im getting this problem https://github.com/facebook/create-react-app/issues/11810 is there a way to solve it ? if i remove this dependency works good

To Reproduce create a new RCA 5 project, and add storybook and start RCA (yarn start)

@storybook/addon-actions”: “^6.4.9”, “@storybook/addon-essentials”: “^6.4.9”, “@storybook/addon-links”: “^6.4.9”, “@storybook/node-logger”: “^6.4.9”, “@storybook/preset-create-react-app”: “^4.0.0”, “@storybook/react”: “^6.4.9”,

System Please paste the results of npx sb@next info here.

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
nephydecodecommented, Aug 2, 2022

Was able to find a workaround for conflict versions for the time being

  1. Ran npm ls react-refresh and it shows a different of react-refresh package versions
├─┬ @storybook/preset-create-react-app@4.1.2
│ └─┬ @pmmmwh/react-refresh-webpack-plugin@0.5.7
│   └── react-refresh@0.14.0
├─┬ @storybook/react@6.5.7
│ └── react-refresh@0.11.0
└─┬ react-scripts@5.0.1
  1. Ran npm dedupe to de-duplicate multiple versions

  2. Ran npm ls react-refresh to check existing versions for react-refresh

├─┬ @storybook/preset-create-react-app@4.1.2
│ └─┬ @pmmmwh/react-refresh-webpack-plugin@0.5.7
│   └── react-refresh@0.11.0 deduped
├─┬ @storybook/react@6.5.7
│ └── react-refresh@0.11.0
└─┬ react-scripts@5.0.1
  └── react-refresh@0.11.0 deduped
  1. npm start compiles & runs successfully
6reactions
shilmancommented, Dec 23, 2021

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.5 containing PR #17056 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there’s still more to do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: react-refresh/runtime.js falls outside of the ...
Module not found : Error: You attempted to import .../node_modules/react-refresh/runtime.js which falls outside of the project src/ directory.
Read more >
Compilation error due to (non-existant) import of react-refresh
Module not found : Error: You attempted to import /home/newlukai/story/app/node_modules/react-refresh/runtime.js which falls outside of the ...
Read more >
module-not-found - Next.js
A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies;...
Read more >
@pmmmwh/react-refresh-webpack-plugin - npm
An EXPERIMENTAL Webpack plugin to enable "Fast Refresh" (also known as Hot Reloading) for React components. This plugin is not 100% stable.
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
If you're a developer that works with Node JS and JavaScript libraries and frameworks like React, Vue, and Angular, then you might have ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found