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

@storybook/vue v6.1.x build failure #13209

Closed
scheinercc opened this issue Nov 22, 2020 · 29 comments
Closed

@storybook/vue v6.1.x build failure #13209

scheinercc opened this issue Nov 22, 2020 · 29 comments

Comments

@scheinercc
Copy link

scheinercc commented Nov 22, 2020

Describe the bug
After upgrading from 6.0.28 to 6.1.2 (also tried with 6.1.0) results in a build failure.

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade from 6.0.28 to 6.1.2
  2. Packages
    "@storybook/addon-viewport": "6.1.2",
    "@storybook/addon-actions": "6.1.2",
    "@storybook/addon-docs": "6.1.2",
    "@storybook/addon-knobs": "6.1.2",
    "@storybook/addon-links": "6.1.2",
    "@storybook/addon-storysource": "6.1.2",
    "@storybook/addons": "6.1.2",
    "@storybook/vue": "6.1.2",
  3. run yarn storybook
  4. See "Code Snippets"
    Error in browser: Cannot GET /

Code snippets

$ yarn storybook
yarn run v1.22.5
$ start-storybook -s ./public -s ./dist -p 6006
info @storybook/vue v6.1.2
info
info => Loading static files from: /Users/[local-path]/dist and serving at / .
info => Loading presets
info => Loading presets
WARN   Failed to load preset: "/Users/[local-path]/node_modules/@storybook/core/dist/server/manager/manager-preset.js"
ERR! Error: Cannot find module 'react-dom/package.json'
ERR! Require stack:
ERR! - /Users/[local-path]/node_modules/@storybook/ui/noop.js
ERR! - ...
...
info => Loading 1 config file in "./.storybook"
info => Loading 6 other files in "./.storybook"
info => Adding stories defined in ".storybook/main.js"
ERR! TypeError: Cannot read property 'publicPath' of undefined
ERR!     at startManager (/Users/[local-path]/node_modules/@storybook/core/dist/server/dev-server.js:324:38)
ERR!     at async Promise.all (index 1)
...
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

info => Using default Webpack setup
...
[./node_modules/@storybook/core/dist/server/preview/globals.js] 93 bytes {vendors~main} [built]
[./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined] (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined 7.68 KiB {vendors~main} [built]
    + 1974 hidden modules

ERROR in ./node_modules/@storybook/core/dist/client/preview/StoryRenderer.js
Module not found: Error: Can't resolve 'react-dom' in '/Users/[local-path]/node_modules/@storybook/core/dist/client/preview'
...
ERROR in ./node_modules/react-popper-tooltip/dist/esm/react-popper-tooltip.js
Module not found: Error: Can't resolve 'react-dom' in '/Users/[local-path]/node_modules/react-popper-tooltip/dist/esm'
...

System

Environment Info:

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 12.18.2 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Browsers:
    Chrome: 87.0.4280.67
    Firefox: 82.0.3
    Safari: 14.0.1
  npmPackages:
    @storybook/addon-actions: 6.1.2 => 6.1.2
    @storybook/addon-docs: 6.1.2 => 6.1.2
    @storybook/addon-knobs: 6.1.2 => 6.1.2
    @storybook/addon-links: 6.1.2 => 6.1.2
    @storybook/addon-storysource: 6.1.2 => 6.1.2
    @storybook/addon-viewport: 6.1.2 => 6.1.2
    @storybook/addons: 6.1.2 => 6.1.2
    @storybook/vue: 6.1.2 => 6.1.2
@shilman
Copy link
Member

shilman commented Nov 22, 2020

Do you have a repro repo you can share?

@shilman shilman reopened this Nov 22, 2020
@shilman shilman modified the milestones: 6.1 perf, 6.1 core Nov 22, 2020
@shilman shilman added the P1 label Nov 22, 2020
@scheinercc
Copy link
Author

scheinercc commented Nov 22, 2020

Do you have a repro repo you can share?

No, it's not public. Sorry.

@HytonightYX
Copy link

Same on version 6.1.2.
My app worked fine last Friday, but not today.

WARN   Failed to load preset: "/Users/husiyuan/dev/my-app/node_modules/_@storybook_core@6.1.2@@storybook/core/dist/server/manager/manager-preset.js"
ERR! Error: Cannot find module 'react/package.json'
ERR! Require stack:
ERR! - /Users/husiyuan/dev/my-app/node_modules/_@storybook_ui@6.1.2@@storybook/ui/noop.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
ERR!     at resolveFileName (/Users/husiyuan/dev/my-app/node_modules/_resolve-from@5.0.0@resolve-from/index.js:29:39)
ERR!     at resolveFrom (/Users/husiyuan/dev/my-app/node_modules/_resolve-from@5.0.0@resolve-from/index.js:43:9)
ERR!     at module.exports (/Users/husiyuan/dev/my-app/node_modules/_resolve-from@5.0.0@resolve-from/index.js:46:47)
ERR!     at Object.<anonymous> (/Users/husiyuan/dev/my-app/node_modules/_@storybook_ui@6.1.2@@storybook/ui/paths.js:17:18)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1063:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:928:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!     at require (internal/modules/cjs/helpers.js:88:18)
ERR!     at Object.<anonymous> (/Users/husiyuan/dev/my-app/node_modules/_@storybook_core@6.1.2@@storybook/core/dist/server/manager/manager-webpack.config.js:34:38)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1063:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:928:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
ERR!  Error: Cannot find module 'react/package.json'

@HytonightYX
Copy link

storybook
"@storybook/addon-essentials": "6.1.2",
"@storybook/addons": "6.1.2",
"@storybook/react": "6.1.2",
"@storybook/theming": "6.1.2"

MacOS Big Sur 11.0.1

@nohira
Copy link

nohira commented Nov 23, 2020

I was on storybook 6.0.28 and I had a message that the 6.1.3 was available.
I've executed the upgrade command and have exactly the same error when starting storybook. I'm using react though.
I tried to remove node_modules and install again and the problem was still here.
Dowgrading to 6.0.28 fixed issues

@shilman
Copy link
Member

shilman commented Nov 23, 2020

Did you try removing node_modules and/or lockfiles and reinstalling?

@nohira
Copy link

nohira commented Nov 23, 2020

In my case, I just removed node_modules folder as I didn't want having other packages being updated. Just wanted to see performance improuvment

@shilman
Copy link
Member

shilman commented Nov 24, 2020

Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.4 containing PR #13230 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

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

@shilman shilman closed this as completed Nov 24, 2020
@michaelaflores
Copy link

michaelaflores commented Nov 24, 2020

@shilman I'm not sure if this requires a new issue or re-opening this one, but I had the same problem as the author except in React (@storybook/react@6.1.x). When I ran npx sb upgrade, moving to @storybook/react@6.1.4, I now see the following when running start-storybook:

✖ 「wdm」: Hash: 99602bd3a64e5e0dd377
Version: webpack 4.44.2
Time: 412ms
Built at: 11/23/2020 9:17:38 PM

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in Entry module not found: Error: Can't resolve './src' in '/Users/michaelflores/workspace/video-client/stories'
10% building 1/1 modules 0 activeWARN Force closed preview build

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

34% building 202/230 modules 28 active /Users/michaelflores/workspace/video-client/stories/node_modules/@storybook/addons/dist/index.jsts-loader: Using ttypescript@3.9.7. This version may or may not be compatible with ts-loader.
94% after seal

It seems to get stuck at 94% and not move from there.

It's rather unclear where the source of this issue is as I don't reference "./src" in my stories, although it's also unclear why this patch upgrade should throw an error in existing code (although perhaps something was fixed that exposed a hidden bug..?).

@scheinercc
Copy link
Author

scheinercc commented Nov 24, 2020

@shilman Sorry for being the bearer of bad news, but I still have the same problem.

  1. Upgraded to 6.1.4
  2. Deleted node_modules and yarn.lock
  3. reinstalled everything

Error still occurs ERR! Error: Cannot find module 'react-dom/package.json' as my description above.

And it now also got stuck at 94% as @michaelaflores mentioned.

Reverting to v6.0.28 fixes it.

@huangxinxia
Copy link

I ran npx sb upgrade, I now see the following when running start-storybook:

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es6.array.iterator' in 'H:\work\test\front\fingard-react-ui\.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 27:0-45
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/react/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/addParameter.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js (webpack)-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./node_modules/@storybook/addon-docs/node_modules/acorn-jsx/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.array.iterator' in 'H:\work\test\front\fingard-react-ui\node_modules\@storybook\addon-docs\node_modules\acorn-jsx'
.......

@shilman shilman reopened this Nov 25, 2020
@shilman
Copy link
Member

shilman commented Nov 25, 2020

@scheinercc Can you upgrade and try again npx sb upgrade

@shilman shilman closed this as completed Nov 25, 2020
@scheinercc
Copy link
Author

Works like a charm! Thanks a lot

@jonwilliams-bluescape
Copy link

same here

System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 14.13.0 - ~/.nvm/versions/node/v14.13.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.13.0/bin/npm
Browsers:
Chrome: 73.0.3683.86
Firefox: 83.0
Safari: 14.0.1
npmPackages:
@storybook/addon-actions: ^6.1.6 => 6.1.6
@storybook/addon-essentials: ^6.1.6 => 6.1.6
@storybook/addon-links: ^6.1.6 => 6.1.6
@storybook/react: ^6.1.6 => 6.1.6

@jonwilliams-bluescape
Copy link

I think mine is a peer dependency issue. Not sure how to resolve it.

@shilman
Copy link
Member

shilman commented Nov 26, 2020

@jonwilliams-bluescape you're still seeing this bug?

@maheshjag
Copy link

maheshjag commented Nov 26, 2020

@shilman I'm running into the same problem. I've tried clearing node_modules, package-lock.json and yarn.lock and then when I run storybook, I get this:

yarn run v1.19.1
warning package.json: No license field
$ start-storybook --port 3000
info @storybook/react v6.1.6
info
info => Loading presets
info => Loading presets
WARN   Failed to load preset: "./node_modules/@storybook/core/dist/server/manager/manager-preset.js"
ERR! Error: Cannot find module 'react/package.json'
ERR! Require stack:
ERR! - ./node_modules/@storybook/ui/noop.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
ERR!     at resolveFileName (./node_modules/resolve-from/index.js:29:39)
ERR!     at resolveFrom (./node_modules/resolve-from/index.js:43:9)
ERR!     at module.exports (./node_modules/resolve-from/index.js:46:47)
ERR!     at Object.<anonymous> (./node_modules/@storybook/ui/paths.js:17:18)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1137:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:985:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
ERR!     at Module.require (internal/modules/cjs/loader.js:1025:19)
ERR!     at require (internal/modules/cjs/helpers.js:72:18)
ERR!     at Object.<anonymous> (./node_modules/@storybook/core/dist/server/manager/manager-webpack.config.js:34:38)
ERR!     at Module._compile (internal/modules/cjs/loader.js:1137:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:985:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:878:14)

and ends with

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

✖ 「wdm」: Hash: d7cf1de00d1837717bff
Version: webpack 4.44.2
Time: 25ms
Built at: 11/26/2020 14:21:31

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in Entry module not found: Error: Can't resolve './src' in './clinical-code-entry'

(I've edited folder names)

@jonwilliams-bluescape
Copy link

@jonwilliams-bluescape you're still seeing this bug?

I moved my storybook setup inside one of the packages in our mono repo (per the engineer who manages the build and such) and the issue went away. I’d been attempting from the project root.

@jonwilliams-bluescape
Copy link

happening again with 6.1.7

@jonwilliams-bluescape
Copy link

jonwilliams-bluescape commented Nov 27, 2020

adding react and react-dom to our peer dependencies seems to have solved the issue
(Also, to be clear we're NOT a vue project as the issue title would suggest)

@fullsnackdeveloper
Copy link

Running into the identical issue as @maheshjag reverting to 6.0.7 got me back up and running

@shilman
Copy link
Member

shilman commented Dec 4, 2020

Does anybody have a repro repo they can share?

@maheshjag
Copy link

@shilman I can't share unfortunately, as the repo is a private one. However, I could share the list of other packages that are used in the project, if that's of any use?

@TheEvilDev
Copy link

I ran into the same problem with storybook 6.1.9. I resolved it by just doing npm install -d react-dom, which wasn't in my dependencies list previously.

@BiancaArtola
Copy link

Same issue here.
ERR! Error: Cannot find module 'react/package.json'

@Blackfaded
Copy link

Having the same issue with ERR! Error: Cannot find module 'react/package.json'.
React is in my peer deps.

@seanburman
Copy link

Installing peer dependencies worked for me.
npm install react react-dom react-scripts

@J-HernandezInzunza
Copy link

I had the exact same issue upgrading to 6.4.13 and its add-ons. I had to do npm install react react-dom --save-dev to fix.

@niki-04
Copy link

niki-04 commented Aug 4, 2022

Facing this same issue, I have react and react-dom as peer dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests