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@6 Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' #14037

Closed
nnnoel opened this issue Feb 24, 2021 · 1 comment

Comments

@nnnoel
Copy link

nnnoel commented Feb 24, 2021

I'm encountering similar issues to the ones discussed here #11255 and other places, but none of the solutions provided or suggested in https://github.com/storybookjs/storybook/blob/master/MIGRATION.md#core-js-dependency-errors appear to be working for me.

I understand the issue has something to do with mismatching core-js dependencies, but I can't seem to find a practical solution.

Afaik, core-js/modules/es7.object.get-own-property-descriptors exists in core-js v2 whereas 'core-js/modules/es.object.get-own-property-descriptors' exists in v3.

Stacktrace
ERR! => Failed to build the preview
ERR! Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '~/project/.storybook'
ERR! ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '~/project/.storybook'
ERR!     at ~/project/node_modules/webpack/lib/Compilation.js:925:10
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:401:22
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:130:21
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:224:22
ERR!     at ~/project/node_modules/neo-async/async.js:2830:7
ERR!     at ~/project/node_modules/neo-async/async.js:6877:13
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:214:25
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!  ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '~/project/.storybook'
ERR!     at ~/project/node_modules/webpack/lib/Compilation.js:925:10
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:401:22
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:130:21
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:224:22
ERR!     at ~/project/node_modules/neo-async/async.js:2830:7
ERR!     at ~/project/node_modules/neo-async/async.js:6877:13
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:214:25
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR! resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '~/project/.storybook'
ERR!   Parsed request is a module
ERR!   using description file: ~/project/package.json (relative path: ./.storybook)
ERR!     Field 'browser' doesn't contain a valid alias configuration
ERR!     resolve as module
ERR!       looking for modules in ~/project/.storybook/stubs
ERR!         using description file: ~/project/package.json (relative path: ./.storybook/stubs)
ERR!           Field 'browser' doesn't contain a valid alias configuration

...

If I manually add core-js@v2.6.12, then I get the following error Module not found: Error: Can't resolve 'core-js/modules/es.symbol.js' when building storybook.

Stacktrace
ERR! Module not found: Error: Can't resolve 'core-js/modules/es.symbol.js' in '~/project/.storybook'
ERR! ModuleNotFoundError: Module not found: Error: Can't resolve 'core-js/modules/es.symbol.js' in '~/project/.storybook'
ERR!     at ~/project/node_modules/webpack/lib/Compilation.js:925:10
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:401:22
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:130:21
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:224:22
ERR!     at ~/project/node_modules/neo-async/async.js:2830:7
ERR!     at ~/project/node_modules/neo-async/async.js:6877:13
ERR!     at ~/project/node_modules/webpack/lib/NormalModuleFactory.js:214:25
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:213:14
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (~/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at ~/project/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:285:5

...

In v5, I was having similar issues, but I was able to get away with adding core-js@v2.6.12. However, I had two problems with that:

  1. I found myself having to manually remove node_modules and install everything again. This became a problem for a CI pipeline in a large codebase.
  2. having to manually add core-js as a dev dependency

These are the following versions of core-js in my project's node_modules (without adding core-js)

core-js@2.6.12 ~/project/node_modules/@babel/polyfill/node_modules/core-js
core-js@1.2.7 ~/project/node_modules/fbjs/node_modules/core-js
core-js@3.6.5 ~/project/node_modules/@typeform/embed/node_modules/core-js
core-js@2.6.12 ~/project/node_modules/babel-runtime/node_modules/core-js
core-js@2.5.3 ~/project/node_modules/attr-accept/node_modules/core-js
core-js@1.2.7 ~/project/node_modules/react-addons-create-fragment/node_modules/core-js
core-js@1.2.7 ~/project/node_modules/react-dnd/node_modules/core-js
core-js@1.2.7 ~/project/node_modules/recompose/node_modules/core-js
core-js@2.5.3 ~/project/node_modules/babel-register/node_modules/core-js
core-js@3.9.0 ~/project/node_modules/core-js
core-js@2.5.5 ~/project/node_modules/webpack-addons/node_modules/core-js

I'm looking for a solution that does not involve aliasing core-js packages.

Expected behavior
No issues related to core-js or reasonable workaround.

System

Environment Info:

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  Binaries:
    Node: 14.13.0 - ~/.asdf/installs/nodejs/14.13.0/bin/node
    Yarn: 1.13.0 - ~/project/node_modules/.bin/yarn
    npm: 6.7.0 - ~/project/node_modules/.bin/npm
  Browsers:
    Chrome: 88.0.4324.192
    Safari: 14.0.3
  npmPackages:
    @storybook/addon-actions: ^6.1.20 => 6.1.20
    @storybook/addon-console: ^1.2.3 => 1.2.3
    @storybook/addon-knobs: ^6.1.20 => 6.1.20
    @storybook/addon-links: ^6.1.20 => 6.1.20
    @storybook/addon-viewport: ^6.1.20 => 6.1.20
    @storybook/addons: ^6.1.20 => 6.1.20
    @storybook/core-events: ^6.1.20 => 6.1.20
    @storybook/react: ^6.1.20 => 6.1.20
@nnnoel nnnoel changed the title Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' storybook@6 Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' Feb 24, 2021
Haroenv added a commit to algolia/instantsearch that referenced this issue Dec 19, 2022
@Haroenv
Copy link
Contributor

Haroenv commented Dec 19, 2022

I noticed this happens too if I had two different versions of storybook in the same package. That happened when I was migrating a monorepo, one was using storybook/html@5.3.9, the other storybook/react@5.0.11, and the problem disappeared when I updated them to be both 5.3.9

Haroenv added a commit to algolia/instantsearch that referenced this issue Jan 4, 2023
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

4 participants