Describe the bug
Ever since beta-6 I get the following error when trying to run storybook:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" It appears to be rooted in getManagerWebpackConfig (/Users/kodmunki/source/kodmunki/ku4/web/ku4web-component/node_modules/@storybook/core/dist/server/manager/manager-config.js:83:18)
To Reproduce
Steps to reproduce the behavior:
start-storybook -s www,assets -p 6006 _(obviously you may not have www or assets)_Expected behavior
Storybook should start as it has through version 5 and up to version 6.0.0-beta.6
System:
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-2557M CPU @ 1.70GHz
Binaries:
Node: 14.2.0 - ~/.nvm/versions/node/v14.2.0/bin/node
npm: 6.14.4 - ~/.nvm/versions/node/v14.2.0/bin/npm
Browsers:
Chrome: 83.0.4103.61
Edge: 83.0.478.37
Firefox: 76.0
Safari: 13.1
npmPackages:
@storybook/addon-a11y: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-actions: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-docs: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-google-analytics: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-knobs: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-links: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-notes: ^5.3.19 => 5.3.19
@storybook/addon-storyshots: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addon-viewport: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/addons: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/react: 6.0.0-beta.16 => 6.0.0-beta.16
@storybook/theming: 6.0.0-beta.16 => 6.0.0-beta.16
it's noticeable that @storybook/addon-notes was deprecated on alpha.6
you should remove it and re-install cleaning up the lock file:
rm -Rf node_modules package-lock.json && npm i (if you use npm)
rm -Rf node_modules yarn.lock && yarn (if you use yarn)
I haven't seen that error and I've been working with v6.0.0 since alpha days, upgraded from v5 too.
Damn! That seemed really promising. Thank you for taking the time to share! It didn’t work, but could you tell me where you are finding your latest info on the progress of beta, i.e. addon-notes was deprecated? I have been trying to find the “source of truth” release notes. Are they GitHub? Is there a forum? Are there multiple? I would GREATLY appreciate your sharing where you are finding the most relevant information. It would be a massive help! — Thanks for the info you already shared! I hope you’d take a moment to LMK where you are finding the docs on the progression through beta. I really appreciate it! ;)
On May 27, 2020, at 7:30 PM, Mateo Tibaquirá notifications@github.com wrote:
it's noticeable that @storybook/addon-notes was deprecated on alpha.6
you should remove it and re-install cleaning up the lock file:
rm -Rf node_modules package-lock.json && npm i (if you use npm)
rm -Rf node_modules yarn.lock && yarn (if you use yarn)
I haven't seen that error and I've been working with v6.0.0 since alpha days, upgraded from v5 too.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/storybookjs/storybook/issues/10955#issuecomment-635017575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWCG6DTJGS2PSATJ45DGLRTWWD7ANCNFSM4NMSMBNA.
@kodmunki All 6.0 breaking changes are documented in MIGRATION.md
I'm facing the same error when using node 12.17.0.
If I downgrade to node 12.16.3 everything works fine. Might this be related to the removal of the --experimental-modules?
Environment Info:
System: macOS 10.15.4
Node: 12.17.0
yarn: 1.22.7
Storybook Dependencies:
"@storybook/addon-actions": "6.0.0-beta.17",
"@storybook/addon-controls": "^6.0.0-beta.17",
"@storybook/addon-docs": "6.0.0-beta.17",
"@storybook/addon-toolbars": "6.0.0-beta.17",
"@storybook/addons": "6.0.0-beta.17",
"@storybook/cli": "6.0.0-beta.17",
"@storybook/react": "6.0.0-beta.17",
"@storybook/theming": "6.0.0-beta.17",
main.js:
module.exports = {
stories: ['../docs/**/*.stories.mdx', '../packages/**/*.stories.mdx', '../packages/**/*.stories.[tj]sx'],
addons: [
'@storybook/addon-toolbars',
'@storybook/addon-docs',
'@storybook/addon-controls',
'@storybook/addon-actions'
],
webpack: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.
config.module.rules.push({
test: /assets\/.*\.json$/,
use: 'file-loader',
type: 'javascript/auto'
});
return config;
}
};
Thank you Michael and Marcus! Going through MIGRATION.md and downgrading to 12.6.3 (I was running node 14 until beta.7 broke everything) fixed my issues. I am still not sure I understand why node v14 was working up to beta.7. I may have to do some more reading. Thank you both for sharing all of the info. Its greatly appreciated!
On May 28, 2020, at 1:48 AM, Marcus Notheis notifications@github.com wrote:
12.16.3
Looks like this issue is happening here
https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/manager/manager-config.js#L18
In my case, it's breaking with rollup package.json
WARN Unable to close preview build!
ERR! Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /project/node_modules/rollup/package.json
ERR! at applyExports (internal/modules/cjs/loader.js:491:9)
ERR! at resolveExports (internal/modules/cjs/loader.js:507:23)
ERR! at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
ERR! at resolveFileName (/project/node_modules/resolve-from/index.js:29:39)
ERR! at resolveFrom (/project/node_modules/resolve-from/index.js:43:9)
ERR! at module.exports (/project/node_modules/resolve-from/index.js:46:47)
ERR! at /project/node_modules/@storybook/core/dist/server/manager/manager-config.js:52:38
ERR! at Array.map (<anonymous>)
ERR! at getAutoRefs (/project/node_modules/@storybook/core/dist/server/manager/manager-config.js:51:109)
ERR! at async getManagerWebpackConfig (/project/node_modules/@storybook/core/dist/server/manager/manager-config.js:83:18)
ERR! Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /project/node_modules/rollup/package.json
ERR! at applyExports (internal/modules/cjs/loader.js:491:9)
ERR! at resolveExports (internal/modules/cjs/loader.js:507:23)
ERR! at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
ERR! at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
ERR! at resolveFileName (/project/node_modules/resolve-from/index.js:29:39)
ERR! at resolveFrom (/project/node_modules/resolve-from/index.js:43:9)
ERR! at module.exports (/project/node_modules/resolve-from/index.js:46:47)
ERR! at /project/node_modules/@storybook/core/dist/server/manager/manager-config.js:52:38
ERR! at Array.map (<anonymous>)
ERR! at getAutoRefs (/project/node_modules/@storybook/core/dist/server/manager/manager-config.js:51:109)
ERR! at async getManagerWebpackConfig (/project/node_modules/@storybook/core/dist/server/manager/manager-config.js:83:18) {
ERR! code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
ERR! }
WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
Thanks @fernandopasik, that looks like it could indeed be a bug. Does anybody have a repro repo we could look at?
I could break one of my repos to have this. But I guess I wanted to ask a bit of context for this commit https://github.com/storybookjs/storybook/commit/68518998de06495fd9b923c67d0a218e2d213260
I've created a branch storybook-beta-update in my repo
https://github.com/fernandopasik/hello-web-components/tree/storybook-beta-update
if you run yarn start it will start storybook and show this error
If we agree maybe of doing a try/catch in this line and return undefined https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/manager/manager-config.js#L18
I would raise a PR with that
@fernandopasik I tried your reproduction repo but this is what I see:

Are you running this from master or from the branch storybook-beta-update?
Looking at the package resolve-from the line that's blowing up is https://github.com/sindresorhus/resolve-from/blob/master/index.js#L43
What am I doing wrong?

oh what node.js version are you running? This happens with > 12.17.0 and 14
I'm looking at a similar issue in https://github.com/then/is-promise/issues/13
They are commenting about a exports field in package.json, and rollup has that. Not sure what the root cause still but this is my last clue.
I know it's a different type of issue but seems related to the format of the package.json
Ok, I found why in some packages this fails.
For instance in rollup if I add "./package.json": "./package.json", to the exports it passes
"exports": {
"./package.json": "./package.json",
".": {
"require": "./dist/rollup.js",
"import": "./dist/es/rollup.js",
"default": "./dist/rollup.js"
},
"./dist/": "./dist/"
}
In another package that fails, rollup-plugin-terser it was a bigger change
from this
"exports": {
"require": "./rollup-plugin-terser.js",
"import": "./rollup-plugin-terser.mjs"
},
to this
"exports": {
"./package.json": "./package.json",
".": {
"require": "./rollup-plugin-terser.js",
"import": "./rollup-plugin-terser.mjs"
}
},
Seems like if the package.json has exports and do not want to expose the root, the code in https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/manager/manager-config.js#L18 won't work at least with the latest versions of node.
Yippee!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.0-beta.22 containing PR #11023 that references this issue. Upgrade today to try it out!
You can find this prerelease on the @next NPM tag.
I've updated my repo with the latest beta, works great, thanks!
Most helpful comment
If we agree maybe of doing a try/catch in this line and return undefined https://github.com/storybookjs/storybook/blob/next/lib/core/src/server/manager/manager-config.js#L18
I would raise a PR with that