greetings, after updating version 4.0.0-alpha.9 to 4.0.0-alpha.12, an error occurs when starting:
module.js:557
throw err;
^
Error: Cannot find module 'core-js/modules/es6.array.for-each'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
It was also after the upgrade 4.0.0-alpha.9 to version 11
update to 10 version of the error did not cause
I have the same error (current node TLS v8.11.3, NPM 5.6).
Looks like this is related to dotenv-universal. There was an update to how .env* files are being processed. core-js is generally more related to the @babel/runtime which is missing. There seems to be a missing dependency somewhere in Storybook to the required peerDependency of the babel runtime.
Workaround for the moment could be npm install -D @babel/runtime. Please report whether this fixes the issue for you.
unfortunately did not help. error after start-up remained.
Is probably auto fixed by moving deps to babel v7: See also: #3746.
Having the same issue. Installed the following deps:
Currently back on 3.4.8.
I have the same issue, with these dependencies
"@storybook/react": "4.0.0-alpha.11",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.5",
"babel-loader": "^7.1.4",
"webpack": "^4.6.0",
The reason I wanted to use 4.0.0-alpha.11 is to get the fix to another error that was addressed in the Theming PR (https://github.com/storybooks/storybook/pull/3628)
@sareh @jamsch @paxarpp Does somebody have a public repo with a reproduction I can take a look at?
@swernerx If adding @babel/runtime is not solving the problem, any idea how we can fix this? Although it's just an alpha, it makes me uneasy that this is breaking for a bunch of people.
@swernerx universal-dotenv uses babel-preset-edge which has [ "@babel/preset-env", {"useBuiltIns": "usage"}], which adds those core-js imports.
This means that you need to add a direct dependency on core-js in universal-dotenv package. BTW, is there any good reason to make @babel/runtime a peer dependency not a direct one?
@sareh @jamsch @paxarpp Current workaround is npm i -D core-js
Of course, here's repo https://github.com/paxarpp/ui_library
@paxarpp Thanks!! What do I need to do to repro? I checked out master and ran it with 4.0.0-alpha.12 and it's working fine. Maybe I need to run it on an older version of node? I'm on 8.11.2...
BTW I love the way you have storybook set up with your library. Looks super clean! ✨🙌
I`m on v9.4.0 How so, can me node_modules to clear and rearrange anew, what that dependences are installed not necessary ???
I do not even know what to suggest, but cloning and launching in a new location did not help, I've had a bug left after the update, maybe something specific in my environment is conflicting, I'll wait for the next updates, thanks for the tip
Most of the time it's some npm install shaking up in my experience. I am lately struggling a lot with jest + babel v7 as well. Seems like the whole ecosystem with mixed babel versions and different npm versions behaving quite differently is making the whole environment super unstable at the moment. What I tried in my projects recently is to add npm -g update npm calls before install to all my CI scripts + using npm dedupe to simplify dependency structures. I figure npm dedupe might also help locally with some of these issues.
@Hypnosphi thanks for the feedback on peerDependencies. I figure I am fine with switching to a real dependency as well. I figured that it's better to be open to other versions of the runtime as long as it's there. This is the reason to go with peerDependencies I thought. I released a new version of dotenv-universal v1.7.0 which uses a dependency for @babel/runtime instead.
thanks that do not leave out of attention, npm dedupe found a few duplications, but the problem is still unresolved.
I figure you @paxarpp could try to update the "dotenv-universal" locally e.g. by installing it in your project.
did not help-(
@swernerx, using v1.7.0 fixes the issue for me.
Seems we should update the dependency in Storybook. Probably this solves the issue for all people then. Installing separately is something different in my experience than having a changed dependency inside one of the own dependencies.
@shilman could we get this bumped in the next alpha release?
@swernerx you need to add a dependency on core-js as well, to avoid relying on npm hoisting
Released 4.0.0-alpha.13 with upgrade to [email protected]. Please try it out and let me know whether or not it fixes the problem!
https://github.com/storybooks/storybook/releases/tag/v4.0.0-alpha.13
@shilman thanks for publishing the new version, but it seems I cannot install it. The npm error is "No matching version found for @storybook/[email protected]". It is strange because I can see version 4.0.0-alpha.13 of @storybook/client-logger in npm website https://www.npmjs.com/package/@storybook/client-logger/v/4.0.0-alpha.13.
Is it some kind of npm caching? I tried "npm cache clean --force" but it did not work.
Never mind, I try again after 30 minutes and can install the new version now. Can confirm the error "Cannot find module 'core-js/modules/es6.array.for-each'" is gone. But I still need to fix something else because this is the first time we use storybook.
the problem is solved:
helped to install the core-js v2.5.7
npm i core-js -save-dev
@swernerx Based on @paxarpp 's comment above it looks like the Storybook upgrade to [email protected] did not fix things, and dotenv-universal also needs to add a core-js dependency per @Hypnosphi 's suggestion. Please let me know if you do another upgrade and I can put out a new alpha to incorporate it. Thanks!
core-js is part of @babel/runtime. There should not be a need for adding it separately. In fact this might also produce issues as it has to be compatible with what the babel transform generates. The docs say that it depends on babel/runtime. Probably the issue is more related to the current double usage of both babe major versions in a lot of code.
Quote from babel docs:
The transformation plugin is typically used only in development, but the runtime itself will be depended on by your deployed/published code.
Via: https://babeljs.io/docs/en/next/babel-plugin-transform-runtime
Thanks for the clarification. Do you have any recommendations about the best path forward here? I'm not a babel expert.. 😁
@paxarpp can you confirm that upgrading storybook to alpha-13 did not fix the problem for you but adding a dep to core-js did?
@Hypnosphi can you weigh in here? Thanks!
I confirm that the upgrade to version 4.0.0-alpha13 did not solve the problem, but when I installed core-js in devDependency, the problem was solved.
I figure my misunderstanding was about which part of Babel does what transpilation part.
Now I see that the env setting useBuiltins: 'usage' is directly adding core-js exports without going through babel-runtime. That's the issue we see here. So @Hypnosphi was absolutely right. Sorry for not understanding it before.
I'll add these to the dependencies correctly and publish a new version.
I just published v1.8.0 of universal-dotenv which contains a dependency to "core-js". Hopefully this fixes the issues of @paxarpp and others.
all ok.
but now addon knobs upgrade from version 4.0.0-alpha10 to version 4.0.0-alpha13
app not work:
ERROR in ./node_modules/react-datetime/DateTime.js
Module not found: Error: Can't resolve 'moment' in 'D:\KODING\ui_library\node_modules\react-datetime'
I do not use this module in my app.
but it's probably not necessary to register here?
@swernerx Thanks for the update. I think @shilman would need to put out another Alpha to include it, so we can test if it solves the issue completely?
Not sure if my issue is related but i just updated to alpha .13 and am now getting Property value expected type of string but got null Do i need to update all of my babel dependencies to from babel to @babel/ ?
@sareh @paxarpp @swernerx Please try out 4.0.0-alpha.14 and let me know if it's working for you!
https://github.com/storybooks/storybook/releases/tag/v4.0.0-alpha.14
thanks a lot, update to alpha.14 is all working
Awesome. Thanks so much everybody! Closing this. 👍
Most helpful comment
@swernerx, using
v1.7.0fixes the issue for me.