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

[Bug] Cannot install @storybook/react #484

Closed
ulrik-s opened this issue Sep 24, 2019 · 16 comments
Closed

[Bug] Cannot install @storybook/react #484

ulrik-s opened this issue Sep 24, 2019 · 16 comments
Labels
bug Something isn't working

Comments

@ulrik-s
Copy link
Contributor

ulrik-s commented Sep 24, 2019

Describe the bug
When I am trying to install @storybook/react and its dependencies I run into a set of problems.
In the end I get the error message below and I cannot seem to get around it.

ERROR in ./.storybook/config.js
Module build failed (from /Users/ulrik/src/yggio/.yarn/virtual/babel-loader-virtual-b421e08490/0/cache/babel-loader-npm-8.0.6-b4a2ea362a.zip/node_modules/babel-loader/lib/index.js):
Error: A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't

Required package: @babel/core (via "@babel/core")
Required by: @babel/plugin-proposal-object-rest-spread@virtual:e347a02eb7999f59b9507600cb34a62b402298c3fca9aeec44e47713ae88277fcc649e780bc2f48576f09c86d7d70beaba4f6010ab17d4b769fc44e6f8e5b033#npm:7.4.4 (via /Users/ulrik/src/yggio/.yarn/virtual/@babel-plugin-proposal-object-rest-spread-virtual-fd98db776c/0/cache/@babel-plugin-proposal-object-rest-spread-npm-7.4.4-49552a88c8.zip/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js)

A clear and concise description of what the bug is.
Symptom is that Storybook does not start up properly.

To Reproduce
Follow these instructions: https://storybook.js.org/docs/guides/guide-react/

//
// Added these to the workspace
//
yarn add babel-loader @babel/core
yarn add @storybook/react
yarn add pnpify
yarn add yarnpkg-pnpify
yarn add @yarnpkg/pnpify
yarn unplug @storybook/core

//
// Added these to the root package.json
//
yarn add babel-runtime
yarn add core-js
yarn add regenerator-runtime
yarn unplug core-js

<create .storybook/config.js>
<create .src/index.stories.js>

yarn pnpify start-storybook

The minimal information needed to reproduce your issue (ideally a package.json with a single dep).
Note that bugs without minimal reproductions might be closed.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment if relevant (please complete the following information):

  • OS: [e.g. OSX, Linux, Windows, ...] OS X
  • Node version [e.g. 8.15.0, 10.15.1, ...] Node 8.11.3
  • Yarn version [e.g. 2.0.0-rc1, ...] 2.0.0-rc.1

Additional context

Add any other context about the problem here.

@ulrik-s ulrik-s added the bug Something isn't working label Sep 24, 2019
@crubier
Copy link
Contributor

crubier commented Oct 14, 2019

Same problem here. For us yarn v2 is unusable in production until we fix this.

We really want to use berry it as it bring our install time down from 3min to 1min, but this is a biiig blocker.

@arcanis
Copy link
Member

arcanis commented Oct 14, 2019

So the problem is that I've never used Storybook and it has a fairly intricated setup, so I'm much less likely to dig into it than in projects that I've used or have a small learning curve 🤔

I'd love to have good compatibility with it though, so if you could make a case study and list all the problems that you hit, I think we would be happy to provide help to fix what we need to in Yarn and Storybook alike.

In the case described in the OP I'd suggest to run yarn why @babel/plugin-proposal-object-rest-spread -R --peers to see what's the dependency chain of plugin-proposal-object-rest-spread, and figure out which package is the one that doesn't provide @babel/core. Then we can make a PR to this package to add the unlisted dependency.

@crubier
Copy link
Contributor

crubier commented Oct 15, 2019

I am not sure, but I feel like there is core problem that might be related.

@arcanis I'd like you to correct me if I am wrong but it seems that a common use case is not addressed by yarn berry correctly:

Generic common use case

Description

Many tools have a config file in which you list the names of the plugins/preset/addons/loaders to use.

The generic situation is that you have:

  • Your package package-a, which uses:
  • The third-party tool tool-b (example: storybook in this case)
  • The package tool-b-preset-c which is a plugin/preset/addon/loader for package tool-b

Here are the respective relevant files:

package-a

package-a/package.json

{ 
  "name": "package-a"
  "devDependencies":{
    "tool-b":"x.x.x",
    "tool-b-preset-c":"x.x.x"
  }
}

package-a/tool-b-config.js, the config file for tool-b in package-a (note the reference to tool-b-preset-c as a string):

{
  "presets": [
    "tool-b-preset-c"
  ]
}

tool-b

tool-b/main.js:

...
// Loads presets based on the names supplied in config file
let loadedPresets = []
for(presetName in config.presets){
  loadedPresets.push( require(presetName) )
}
...

Consequence

In this situation, we see that during the preset loading phase, tool-b will try to load tool-b-preset-c which is not in his dependencies, and it will fail.

Example with storybook

In my storybook config I have a .storybook/presets.js file which allows to specify presets to be loaded by storybook like this:

const path = require("path");

module.exports = [
  {
    name: "@foo/my-preset-package",
    options: {
      tsDocgenLoaderOptions: {
        tsconfigPath: path.resolve(__dirname, "../tsconfig.json")
      },
      include: [path.resolve(__dirname, "../src")]
    }
  }
];

When I try to run storybook, yarn errors because storybook is trying to require @foo/my-preset-package while it is not in its dependencies

@arcanis
Copy link
Member

arcanis commented Oct 15, 2019

Even in Yarn 1 and npm, because of how the hoisting works, requiring unlisted packages may have different behaviours than what you'd expect (the wrong packages may end up returned by Node).

Fortunately, the fix is easy: the plugins you mention just have to be loaded from the perspective of the file that lists them. There are two ways to do this:

  • If the tool supports using a JS file instead of a JSON file to list the plugins, you can straight up use require.resolve instead of the raw plugin names. This will ensure that the plugins will be referenced through the right versions of each plugin.

  • If the tool only supports JSON, then it must use createRequire (or createRequireFromPath, or a polyfill) to resolve the dependency from the file that declares it.

That said, I'm not 100% sure I understand the Storybook example you mention. Is the .storybook folder generated in your project? If so it should have access to @foo/my-preset-package, if you've declared it (since .storybook isn't the folder of the storybook package).

@crubier
Copy link
Contributor

crubier commented Oct 15, 2019

In my example the .storybook folder is the standard folder where config files for storybook are stored. These files are manual configuration files, they are not generated automatically.

I will try what you suggest, it might actually work! I will come back to report

@kilpatty
Copy link

@crubier any progress on this? Running into the exact same issue.

@crubier
Copy link
Contributor

crubier commented Nov 19, 2019

Nope. I let it go for now...

@ulrik-s
Copy link
Contributor Author

ulrik-s commented Nov 21, 2019

Here is a small storybook project illustrating the problem:
https://github.com/ulrik-s/storybook-on-yarn2.git

run the script runme.sh.
To see a working version run "npm install && npm run storybook" from my-app

@crubier
Copy link
Contributor

crubier commented Nov 23, 2019

Thank you @ulrik-s , I also created a repo with a detailed guide of the steps, at https://github.com/crubier/yarnv2-storybook

@larixer
Copy link
Member

larixer commented Nov 25, 2019

So, I have looked briefly at Storybook support. Except of not-listed dependencies, that are easy to fix, there is a problem that Storybook does not give us full control of overriding webpack configs and uses webpack config with hardcoded <projectRoot>/node_modules exclude path. Specifically I refer to this Webpack config, which has the problem on this line:
https://github.com/storybookjs/storybook/blob/7256fe638b4f7a38b39552470189fef4604b834b/lib/core/src/server/manager/manager-webpack.config.js#L89
The problem with this line is that this webpack rule has exclude regexp that do not work well with module locations <projectRoot>/.yarn/cache/foo.zip/node_modules/foo.
The exclude pattern used for babel by Storybook is:
<projectRoot>/node_modules which effectively will run babel transpilation on all the Yarn v2 module pathes. If the exclude pattern were /node_modules/ instead, we would have no such a problem.
This exclude pattern is created here:
https://github.com/storybookjs/storybook/blob/7256fe638b4f7a38b39552470189fef4604b834b/lib/core/src/server/common/babel-loader.js#L12
which in turn gets excludePaths from here:
https://github.com/storybookjs/storybook/blob/7256fe638b4f7a38b39552470189fef4604b834b/lib/core/src/server/config/utils.js#L5-L6
Note that nasty path.resolve('./node_modules'); code...

P.S. Hmm, seems there is a hacky way to tweak manager webpack config for Storybook:
storybookjs/storybook#4995

@larixer
Copy link
Member

larixer commented Nov 25, 2019

To make @crubier repo work, the following steps need to be made:

  1. Upgrade to latest unreleased atm Yarn v2 with PR Implements package extensions #600, aka packageExtensions support (this step is optional, but convenient, the same effect can be achieved by editing lockfile instead)
    yarn set version from sources
    Add these lines to .yarnrc.yml:
packageExtensions:
  "@storybook/core@*":
    peerDependencies:
      "@babel/core": "*"
  "@storybook/api@*":
    peerDependencies:
      "regenerator-runtime": "*"
  "corejs-upgrade-webpack-plugin@*":
    dependencies:
      core-js: ^2.6.10
      babel-runtime: ^6.26.0

Run

yarn

to apply packageExtensions.
Unplug @storybook/core module via:
yarn unplug @storybook/core
because Storybook tries to write inside it and cannot do so, because it is inside archive.
Create empty node_modules folder, otherwise Storybook fails to understand where to place babel cache.
Replace .storybook/yarn-preset.js with this:

const PnpWebpackPlugin = require(`pnp-webpack-plugin`);

async function yarn2Config(config, options) {
  const newConfig = {
    ...(config || {}),
    resolve: {
      ...((config || {}).resolve || {}),
      plugins: [
        ...(((config || {}).resolve || {}).plugins || []),
        PnpWebpackPlugin
      ]
    },
    resolveLoader: {
      ...((config || {}).resolveLoader || {}),
      plugins: [
        ...(((config || {}).resolveLoader || {}).plugins || []),
        PnpWebpackPlugin.moduleLoader(module)
      ]
    }
  };
  const jsRule = newConfig.module.rules.find((rule) => rule.test.test('.js'));
  jsRule.exclude = /node_modules/;

  return newConfig;
}

module.exports = { managerWebpack: yarn2Config, webpack: yarn2Config };

This ensures that node_modules will NOT be transpiled via Babel, see my comment above for clarification.

yarn storybook

should work now.

P.S. The comment was updated to incorporate fixes below.

crubier added a commit to crubier/yarnv2-storybook that referenced this issue Nov 25, 2019
@crubier
Copy link
Contributor

crubier commented Nov 25, 2019

@larixer I just tried the solution you suggested in your last comment. I end up with a new error.

It's described here https://github.com/crubier/yarnv2-storybook#fix-using-larixer-method

I am on MacOS, if this is relevant.

The error:

ERR! Error: EROFS: read-only filesystem, mkdir '/node_modules/@storybook/core/dist/public'
ERR!     at makeError (/Users/vincent/yarnv2-storybook/.pnp.js:25485:24)
ERR!     at EROFS (/Users/vincent/yarnv2-storybook/.pnp.js:25515:10)
ERR!     at ZipFS_ZipFS.mkdirSync (/Users/vincent/yarnv2-storybook/.pnp.js:26276:30)
ERR!     at ZipFS_ZipFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26269:17)
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:26988:26
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:27152:79
ERR!     at ZipOpenFS_ZipOpenFS.getZipPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27224:20)
ERR!     at ZipOpenFS_ZipOpenFS.makeCallPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27152:23)
ERR!     at ZipOpenFS_ZipOpenFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26983:23)
ERR!     at VirtualFS_VirtualFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)
ERR!     at PosixFS_PosixFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:27627:9
ERR!     at processTicksAndRejections (internal/process/task_queues.js:75:11)
ERR!  Error: EROFS: read-only filesystem, mkdir '/node_modules/@storybook/core/dist/public'
ERR!     at makeError (/Users/vincent/yarnv2-storybook/.pnp.js:25485:24)
ERR!     at EROFS (/Users/vincent/yarnv2-storybook/.pnp.js:25515:10)
ERR!     at ZipFS_ZipFS.mkdirSync (/Users/vincent/yarnv2-storybook/.pnp.js:26276:30)
ERR!     at ZipFS_ZipFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26269:17)
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:26988:26
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:27152:79
ERR!     at ZipOpenFS_ZipOpenFS.getZipPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27224:20)
ERR!     at ZipOpenFS_ZipOpenFS.makeCallPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27152:23)
ERR!     at ZipOpenFS_ZipOpenFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26983:23)
ERR!     at VirtualFS_VirtualFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)
ERR!     at PosixFS_PosixFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)
ERR!     at /Users/vincent/yarnv2-storybook/.pnp.js:27627:9
ERR!     at processTicksAndRejections (internal/process/task_queues.js:75:11) {
ERR!   stack: "Error: EROFS: read-only filesystem, mkdir '/node_modules/@storybook/core/dist/public'\n" +
ERR!     '    at makeError (/Users/vincent/yarnv2-storybook/.pnp.js:25485:24)\n' +
ERR!     '    at EROFS (/Users/vincent/yarnv2-storybook/.pnp.js:25515:10)\n' +
ERR!     '    at ZipFS_ZipFS.mkdirSync (/Users/vincent/yarnv2-storybook/.pnp.js:26276:30)\n' +
ERR!     '    at ZipFS_ZipFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26269:17)\n' +
ERR!     '    at /Users/vincent/yarnv2-storybook/.pnp.js:26988:26\n' +
ERR!     '    at /Users/vincent/yarnv2-storybook/.pnp.js:27152:79\n' +
ERR!     '    at ZipOpenFS_ZipOpenFS.getZipPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27224:20)\n' +
ERR!     '    at ZipOpenFS_ZipOpenFS.makeCallPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27152:23)\n' +
ERR!     '    at ZipOpenFS_ZipOpenFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:26983:23)\n' +
ERR!     '    at VirtualFS_VirtualFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)\n' +
ERR!     '    at PosixFS_PosixFS.mkdirPromise (/Users/vincent/yarnv2-storybook/.pnp.js:27415:24)\n' +
ERR!     '    at /Users/vincent/yarnv2-storybook/.pnp.js:27627:9\n' +
ERR!     '    at processTicksAndRejections (internal/process/task_queues.js:75:11)',
ERR!   code: 'EROFS'
ERR! }

WARN FATAL broken build!, will close the process,
WARN Fix the error below and restart storybook.

@larixer
Copy link
Member

larixer commented Nov 25, 2019

@crubier Hmm, I'm on OS X as well, strangely I didn't saw this problem. But you can easily work around it by doing yarn unplug @storybook/core

@crubier
Copy link
Contributor

crubier commented Nov 25, 2019

@larixer I now get:

ModuleNotFoundError: Module not found: Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: core-js (via "core-js/library/fn/object/assign")
Required by: corejs-upgrade-webpack-plugin@npm:2.2.0 (via /Users/vincent/yarnv2-storybook/.yarn/cache/corejs-upgrade-webpack-plugin-npm-2.2.0-93680a64ba-1.zip/node_modules/corejs-upgrade-webpack-plugin/dist/index.js)

    at factory.create (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:925:10)
    at hooks.beforeResolve.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:390:21)
    at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:12:1)
    at NormalModuleFactory.create (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:381:28)
    at semaphore.acquire (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:897:14)
    at Semaphore.acquire (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/util/Semaphore.js:29:4)
    at asyncLib.forEach (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:895:15)
    at arrayEach (/Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:2405:9)
    at Object.each (/Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:2846:9)
    at Compilation.addModuleDependencies (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:873:12)
    at Compilation.processModuleDependencies (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:843:8)
    at afterBuild (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:954:15)
    at buildModule.err (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:998:11)
    at callback (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:734:5)
    at module.build.error (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:782:12)
    at handleParseResult (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModule.js:478:12)
ModuleNotFoundError: Module not found: Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: regenerator-runtime (via "regenerator-runtime/runtime")
Required by: @storybook/api@npm:5.2.6 (via /Users/vincent/yarnv2-storybook/.yarn/cache/@storybook-api-npm-5.2.6-95bb1a9488-1.zip/node_modules/@storybook/api/dist/modules/shortcuts.js)

    at factory.create (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:925:10)
    at factory (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
    at resolver (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
    at asyncLib.parallel (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:2830:7
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:6877:13
    at normalResolver.resolve (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
    at doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:207:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:42:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:64:26)
ModuleNotFoundError: Module not found: Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: regenerator-runtime (via "regenerator-runtime/runtime")
Required by: @storybook/api@npm:5.2.6 (via /Users/vincent/yarnv2-storybook/.yarn/cache/@storybook-api-npm-5.2.6-95bb1a9488-1.zip/node_modules/@storybook/api/dist/modules/versions.js)

    at factory.create (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:925:10)
    at factory (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
    at resolver (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
    at asyncLib.parallel (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:2830:7
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:6877:13
    at normalResolver.resolve (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
    at doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:207:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:42:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:64:26)
ModuleNotFoundError: Module not found: Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: regenerator-runtime (via "regenerator-runtime/runtime")
Required by: @storybook/api@npm:5.2.6 (via /Users/vincent/yarnv2-storybook/.yarn/cache/@storybook-api-npm-5.2.6-95bb1a9488-1.zip/node_modules/@storybook/api/dist/store.js)

    at factory.create (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compilation.js:925:10)
    at factory (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
    at resolver (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
    at asyncLib.parallel (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:2830:7
    at /Users/vincent/yarnv2-storybook/.yarn/cache/neo-async-npm-2.6.1-96bc443be6-1.zip/node_modules/neo-async/async.js:6877:13
    at normalResolver.resolve (/Users/vincent/yarnv2-storybook/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
    at doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:207:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:42:23)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at hook.callAsync (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/Resolver.js:283:21)
    at _fn0 (eval at create (/Users/vincent/yarnv2-storybook/.yarn/cache/tapable-npm-1.1.3-f1c2843426-1.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
    at resolver.doResolve (/Users/vincent/yarnv2-storybook/.yarn/cache/enhanced-resolve-npm-4.1.1-963440ab7f-1.zip/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:64:26)

Sorry... I promise I follow orders 100% ! I updated the repo

@larixer
Copy link
Member

larixer commented Nov 25, 2019

@crubier Hmm, yes, now I see these problems on your repo. Try to update packageExtensions please in .yarnrc.yml to:

packageExtensions:
  "@storybook/core@*":
    peerDependencies:
      "@babel/core": "*"
  "@storybook/api@*":
    peerDependencies:
      "regenerator-runtime": "*"
  "corejs-upgrade-webpack-plugin@*":
    dependencies:
      core-js: ^2.6.10
      babel-runtime: ^6.26.0

@crubier
Copy link
Contributor

crubier commented Nov 25, 2019

It did work finally! Well done @larixer ! Commiting the solution to the repo.

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

5 participants