storybook: [Bug]: [7.0.0.0-beta.38] Storybook add-ons could not be resolved after migrating to v7
Describe the bug
After migrating from v6.5.15 to v7.0.0.0-beta.38 I get the below errors in my terminal whenever I start storybook. Not sure if relevant, but I don’t use yarn PnP.
✘ [ERROR] Could not resolve "@storybook/addon-measure/manager"
node_modules/@storybook/addon-essentials/dist/measure/manager.mjs:1:11:
1 │ export*from"@storybook/addon-measure/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-measure" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-measure/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-controls/manager"
node_modules/@storybook/addon-essentials/dist/controls/manager.mjs:1:11:
1 │ export*from"@storybook/addon-controls/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-controls" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-controls/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-toolbars/manager"
node_modules/@storybook/addon-essentials/dist/toolbars/manager.mjs:1:11:
1 │ export*from"@storybook/addon-toolbars/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-toolbars" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-toolbars/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-viewport/manager"
node_modules/@storybook/addon-essentials/dist/viewport/manager.mjs:1:11:
1 │ export*from"@storybook/addon-viewport/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-viewport" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-viewport/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-outline/manager"
node_modules/@storybook/addon-essentials/dist/outline/manager.mjs:1:11:
1 │ export*from"@storybook/addon-outline/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-outline" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-outline/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-backgrounds/manager"
node_modules/@storybook/addon-essentials/dist/backgrounds/manager.mjs:1:11:
1 │ export*from"@storybook/addon-backgrounds/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-backgrounds" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-backgrounds/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-actions/manager"
node_modules/@storybook/addon-essentials/dist/actions/manager.mjs:1:11:
1 │ export*from"@storybook/addon-actions/manager";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-actions" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-actions/manager" as external to exclude it
from the bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/global"
node_modules/@storybook/addon-interactions/dist/manager.mjs:1:7335:
1 │ ...port{global as global2}from"@storybook/global";import*as React15 from"re...
╵ ~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/global" here because it's
not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/global" as external to exclude it from the bundle,
which will remove this error.
✘ [ERROR] Could not resolve "@storybook/instrumenter"
node_modules/@storybook/addon-interactions/dist/manager.mjs:1:7636:
1 │ ...ates as CallStates6}from"@storybook/instrumenter";import*as React14 from...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/instrumenter" here because
it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/instrumenter" as external to exclude it from the
bundle, which will remove this error.
✘ [ERROR] Could not resolve "react-resize-detector"
node_modules/@storybook/addon-a11y/dist/manager.mjs:1:5397:
1 │ ...rt{useResizeDetector}from"react-resize-detector";var List=styled3.div({d...
╵ ~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "react-resize-detector" here because
it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "react-resize-detector" as external to exclude it from the
bundle, which will remove this error.
✘ [ERROR] Could not resolve "@storybook/addon-highlight"
node_modules/@storybook/addon-a11y/dist/manager.mjs:1:6942:
1 │ ...;import{HIGHLIGHT}from"@storybook/addon-highlight";var colorsByType=[con...
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "@storybook/addon-highlight" here
because it's not listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "@storybook/addon-highlight" as external to exclude it from the
bundle, which will remove this error.
✘ [ERROR] Could not resolve "polished"
node_modules/@storybook/addon-interactions/dist/manager.mjs:1:7913:
1 │ ...rentize as transparentize3}from"polished";import React2 from"react";impo...
╵ ~~~~~~~~~~
The Yarn Plug'n'Play manifest forbids importing "polished" here because it's not
listed as a dependency of this package:
../../../.pnp.cjs:43:33:
43 │ "packageDependencies": [\
╵ ~~
You can mark the path "polished" as external to exclude it from the bundle, which will
remove this error.
ERR! Error: Build failed with 12 errors:
ERR! node_modules/@storybook/addon-a11y/dist/manager.mjs:1:5397: ERROR: Could not resolve "react-resize-detector"
ERR! node_modules/@storybook/addon-a11y/dist/manager.mjs:1:6942: ERROR: Could not resolve "@storybook/addon-highlight"
ERR! node_modules/@storybook/addon-essentials/dist/actions/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-actions/manager"
ERR! node_modules/@storybook/addon-essentials/dist/backgrounds/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-backgrounds/manager"
ERR! node_modules/@storybook/addon-essentials/dist/controls/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-controls/manager"
ERR! ...
ERR! at failureErrorWithLog (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1604:15)
ERR! at /Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1056:28
ERR! at runOnEndCallbacks (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1476:61)
ERR! at buildResponseToResult (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1054:7)
ERR! at /Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1166:14
ERR! at responseCallbacks.<computed> (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:701:9)
ERR! at handleIncomingPacket (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:756:9)
ERR! at Socket.readFromStdout (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:677:7)
ERR! at Socket.emit (node:events:513:28)
ERR! at addChunk (node:internal/streams/readable:324:12)
ERR! Error: Build failed with 12 errors:
ERR! node_modules/@storybook/addon-a11y/dist/manager.mjs:1:5397: ERROR: Could not resolve "react-resize-detector"
ERR! node_modules/@storybook/addon-a11y/dist/manager.mjs:1:6942: ERROR: Could not resolve "@storybook/addon-highlight"
ERR! node_modules/@storybook/addon-essentials/dist/actions/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-actions/manager"
ERR! node_modules/@storybook/addon-essentials/dist/backgrounds/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-backgrounds/manager"
ERR! node_modules/@storybook/addon-essentials/dist/controls/manager.mjs:1:11: ERROR: Could not resolve "@storybook/addon-controls/manager"
ERR! ...
ERR! at failureErrorWithLog (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1604:15)
ERR! at /Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1056:28
ERR! at runOnEndCallbacks (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1476:61)
ERR! at buildResponseToResult (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1054:7)
ERR! at /Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:1166:14
ERR! at responseCallbacks.<computed> (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:701:9)
ERR! at handleIncomingPacket (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:756:9)
ERR! at Socket.readFromStdout (/Users/tim/Documents/projects/ntri-components-react/node_modules/esbuild/lib/main.js:677:7)
ERR! at Socket.emit (node:events:513:28)
ERR! at addChunk (node:internal/streams/readable:324:12) {
ERR! errors: [
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "react-resize-detector"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-highlight"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-actions/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-backgrounds/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-controls/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-measure/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-outline/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-toolbars/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/addon-viewport/manager"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/global"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "@storybook/instrumenter"'
ERR! },
ERR! {
ERR! detail: undefined,
ERR! id: '',
ERR! location: [Object],
ERR! notes: [Array],
ERR! pluginName: '',
ERR! text: 'Could not resolve "polished"'
ERR! }
ERR! ],
ERR! warnings: []
ERR! }
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
I’m using Vite and React.
To Reproduce
The same issue appears in a reproduction with `npx sb@next sandbox` and no adjustments.
System
System:
OS: macOS 13.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 18.13.0 - /usr/local/bin/node
Yarn: 3.2.1 - /usr/local/bin/yarn
npm: 8.19.3 - /usr/local/bin/npm
Browsers:
Chrome: 109.0.5414.119
Firefox: 109.0
Safari: 16.2
npmPackages:
@storybook/addon-essentials: ^7.0.0-beta.38 => 7.0.0-beta.38
@storybook/addon-interactions: ^7.0.0-beta.38 => 7.0.0-beta.38
@storybook/addon-links: ^7.0.0-beta.38 => 7.0.0-beta.38
@storybook/blocks: ^7.0.0-beta.38 => 7.0.0-beta.38
@storybook/react: ^7.0.0-beta.38 => 7.0.0-beta.38
@storybook/react-vite: ^7.0.0-beta.38 => 7.0.0-beta.38
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 18 (5 by maintainers)
I am having this exact issue and it is easily reproducible through Nuxt 3 project.
I also re-installed the packages using
yarn v3.5.0withnodeLinker: node-modules. I am not sure how to work around this.EDIT I was able to solve the problem by deleting
~/.pnp.cjsthat I found in my home directory.@s0n4 you could try running something like this on your command line:
Then, if you don’t find anything, look in
/usersand/just in case. The fact that you had a pnp state folder in your home tells me that you did have pnp running there at one time, so there’s probably a.pnpfile there somewhere (maybe with a different extension).I was facing exactly the same issue after automatic upgrade. Removing
~/.pnp.cjshelped me, as @AbuHafsa suggested 🙏After trying everything else, removing
~/.pnp.cjsas @AbuHafsa suggested also worked for me 🚀This should be documented somewhere 🕵️
This solved my problem. Like other users, I didn’t have a
.pnp.cjsin my project. However, turns out I somehow had one lingering around in one of the parent folders (e.g.../../.pnp.cjs) of my project which this command immediately showed.we are running to the same issue in next project after running
npx storybook@latest upgradewe have tried to delete node_modules install it manually with Yarn but nothing is working. We did not found solution in parent task.we are using next, node v18.12.1, and yarn is 3.3.1
resolved with removing
.pnp.js.I have the exact same issue, but i don’t seem to have a .pnp.cjs. Neither at my home director nor in the project root. I do run the storybook as a yarn-workspace however. So i have a pnpm-workspace.yaml. My .yarnrc.yml in the root folder includes the following lines to make sure not to use pnp but i still get the pnp-linked errors mentioned above.
In my home directory i had a .pnp-state folder which i tried to delete but didn’t seem to help.
My setup:
Maybe someone has another idea?
EDIT: I found it. It had been hiding in the parent folder of my project. That did indeed fix some issues.
I
I had to do the same… makes no sense! first time I heard of it
Just ran into this issue and deleting .pnp.cjs did the trick. 🎃
@shilman Hi, as the issue you mentioned is closed, should this issue be fixed in 7.0.0-beta.48? (I still get these errors)