Open coreybruyere opened 2 years ago
@coreybruyere I wonder if you need to use the Webpack5 builder because NextJS is on Webpack5. That shouldn't be the case, but I'd give it a try: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build
I encountered this error too (I'm using create-react-app) I'm on storybook version ~6.3.12 (because I cannot upgrade to a newer version) and I upgraded react-scripts to version 5.0.0 as well as @storybook/preset-create-react-app to 4.0.0
@israelKusayev have you tried using webpack5 builder?
@shilman what do you mean? React scripts version 5 internally uses webpack5 (When you use create react app you donβt have control on webpack version and config )
Storybook has a webpack5 builder
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5
Looks like I'm able to successfully build by following these storybook docs for migrating from 6.2.x to 6.3.0.
For reference, this is a fresh storybook setup (post 6.3.0) and I was receiving this error.
@coreybruyere i'm glad to hear you got it sorted. do you happen know which step fixed the problem for you? or how I might reproduce the problem on a fresh project? thanks! π
I had the same issue while updating to 6.4.18 with Angular 13. The issue is caused by having multiple versions of webpack in the same repo.
What I did is to run npm ls webpack
and see that in my case there were both 5.68.0
and 5.67.0
installed. To fix the issue I've added "webpack": "5.67.0"
to my devDependencies
in package.json, and also an override for webpack in package.json.
"overrides": {
"webpack": "5.67.0"
}
After doing this, everything works again.
I've just got this myself - wondering which version of webpack is causing the issue
npm ls webpack
result:
my-project@0.0.1 /work/my-project
βββ¬ @angular-devkit/build-angular@14.0.5
β βββ webpack@5.72.1
βββ¬ @storybook/addon-controls@6.5.9
β βββ¬ @storybook/core-common@6.5.9
β βββ webpack@4.46.0
βββ¬ @storybook/addon-storyshots@6.5.9
β βββ¬ @storybook/core@6.5.9
β βββ¬ @storybook/core-server@6.5.9
β βββ¬ @storybook/builder-webpack4@6.5.9
β β βββ UNMET PEER DEPENDENCY webpack@4.46.0
β βββ¬ @storybook/manager-webpack4@6.5.9
β β βββ webpack@4.46.0
β βββ webpack@4.46.0
βββ¬ @storybook/angular@6.5.9
β βββ webpack@5.70.0 deduped
βββ¬ @storybook/builder-webpack5@6.5.9
β βββ webpack@5.70.0 deduped
βββ¬ @storybook/manager-webpack5@6.5.9
β βββ webpack@5.70.0 deduped
βββ webpack@5.70.0
Puzzled as to why Storybook's own addons controls
& storyshots
are requesting Webpack 4 π€
This guy solved a similar error by walking into the opposite direction than @bogdanconstantinescu did: https://github.com/angular/angular-cli/issues/20773#issuecomment-845426252
Also if you have a resolutions
block inside you package.json, you should read this
https://github.com/angular/angular-cli/issues/20773#issuecomment-856152119
I have the same error. Sadly, none of the three above-mentioned solutions work for me.
$ npx sb@next info
Environment Info:
System:
OS: macOS 12.2
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Browsers:
Chrome: 104.0.5112.79
Firefox: 103.0.2
Safari: 15.3
npmPackages:
@storybook/addon-actions: 6.5.10 => 6.5.10
@storybook/addon-docs: 6.5.10 => 6.5.10
@storybook/addon-essentials: 6.5.10 => 6.5.10
@storybook/addon-links: 6.5.10 => 6.5.10
@storybook/addon-viewport: 6.5.10 => 6.5.10
@storybook/angular: 6.5.10 => 6.5.10
@storybook/builder-webpack5: 6.5.10 => 6.5.10
@storybook/cli: 6.5.10 => 6.5.10
@storybook/manager-webpack5: 6.5.10 => 6.5.10
I followed the Manually
steps in the migration guide
npm install @storybook/builder-webpack5 @storybook/manager-webpack5 --save-dev
In the .storybook/main.js
module.exports = {
core: {
builder: 'webpack5',
}
}
I'm getting the same erro, but I'm using:
framework: '@storybook/vue3',
core: {
builder: '@storybook/builder-vite',
},
I currently have webpack@4
installed due to another build unrelated to the project that storybook builds with, but I need to update it to webpack@5
now, and despite the fact I'm using builder-vite
, this error still shows, donno, didn't get why
@vhoyer 6.x uses the webpack to build storybook's "manager UI" (the sidebar/toolbar/addons). we've gotten rid of this entirely in 7.0 so you can use vite without any webpack deps. but for now you're def getting some interplay between webpack5 in your project and webpack4 that's used to build the manager by default.
there might not be a good workaround since i don't think we allow you to set the manager builder independently of the preview builder
const builderPackage = ['webpack5', '@storybook/builder-webpack5'].includes(builderName)
? require.resolve('@storybook/manager-webpack5', { paths: [main] })
: '@storybook/manager-webpack4';
so you might be able to fix the issue by (1) switching to builder-webpack5
across the board, (2) getting rid of your webpack5 dependencies, (3) potentially using some kind of yarn/npm resolutions hack.
or you could upgrade to 7.0-alpha, which is dramatically faster & has much better vite support, but is still prerelease. we'll hopefully release a beta in the next couple months
npx sb@next upgrade --prerelease
Hello everyone the bug was created by diffrent webpack version in one project. For me, using npm install --legacy-peer-deps solved the problem!
Looking forward for storybook v7 !
Describe the bug
To Reproduce I'm trying to run
npm run build-storybook
and getting the error above. I've seen mentions about misaligned webpack versions. I don't have webpack as a defined dep. Using StoryBook inside of a NextJS app.System
Additional context
npm run build-storybook
results in this error: