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

failed after update to 4.0.0-alpha.12 #3830

Closed
paxarpp opened this issue Jul 4, 2018 · 41 comments
Closed

failed after update to 4.0.0-alpha.12 #3830

paxarpp opened this issue Jul 4, 2018 · 41 comments

Comments

@paxarpp
Copy link

paxarpp commented Jul 4, 2018

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. (D:\KODING\ui_library\node_modules\universal-dotenv\lib\index.cjs.js:11:1)
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

@paxarpp
Copy link
Author

paxarpp commented Jul 4, 2018

update to 10 version of the error did not cause

@webholics
Copy link

I have the same error (current node TLS v8.11.3, NPM 5.6).

@swernerx
Copy link
Contributor

swernerx commented Jul 4, 2018

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.

@swernerx
Copy link
Contributor

swernerx commented Jul 4, 2018

Workaround for the moment could be npm install -D @babel/runtime. Please report whether this fixes the issue for you.

@paxarpp
Copy link
Author

paxarpp commented Jul 4, 2018

unfortunately did not help. error after start-up remained.

@swernerx
Copy link
Contributor

swernerx commented Jul 4, 2018

Is probably auto fixed by moving deps to babel v7: See also: #3746.

@jamsch
Copy link

jamsch commented Jul 4, 2018

Having the same issue. Installed the following deps:

  • react-native@0.56.0
  • @storybook/react-native@4.0.0-alpha.12
  • @babel/runtime@7.0.0-beta.51

Currently back on 3.4.8.

@sareh
Copy link

sareh commented Jul 5, 2018

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 (#3628)

@shilman
Copy link
Member

shilman commented Jul 5, 2018

@sareh @jamsch @paxarpp Does somebody have a public repo with a reproduction I can take a look at?

@shilman
Copy link
Member

shilman commented Jul 5, 2018

@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.

@Hypnosphi
Copy link
Member

@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

@paxarpp
Copy link
Author

paxarpp commented Jul 5, 2018

Of course, here's repo https://github.com/paxarpp/ui_library

@shilman
Copy link
Member

shilman commented Jul 5, 2018

@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! ✨🙌

@paxarpp
Copy link
Author

paxarpp commented Jul 5, 2018

I`m on v9.4.0 How so, can me node_modules to clear and rearrange anew, what that dependences are installed not necessary ???

@paxarpp
Copy link
Author

paxarpp commented Jul 6, 2018

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

@swernerx
Copy link
Contributor

swernerx commented Jul 6, 2018

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.

@swernerx
Copy link
Contributor

swernerx commented Jul 6, 2018

@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.

@paxarpp
Copy link
Author

paxarpp commented Jul 6, 2018

thanks that do not leave out of attention, npm dedupe found a few duplications, but the problem is still unresolved.

@swernerx
Copy link
Contributor

swernerx commented Jul 6, 2018

I figure you @paxarpp could try to update the "dotenv-universal" locally e.g. by installing it in your project.

@paxarpp
Copy link
Author

paxarpp commented Jul 6, 2018

did not help-(

@ztoben
Copy link

ztoben commented Jul 6, 2018

@swernerx, using v1.7.0 fixes the issue for me.

@swernerx
Copy link
Contributor

swernerx commented Jul 8, 2018

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.

@ztoben
Copy link

ztoben commented Jul 9, 2018

@shilman could we get this bumped in the next alpha release?

@Hypnosphi
Copy link
Member

@swernerx you need to add a dependency on core-js as well, to avoid relying on npm hoisting

@shilman
Copy link
Member

shilman commented Jul 10, 2018

Released 4.0.0-alpha.13 with upgrade to dotenv-universal@1.7.0. 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

@baocancode
Copy link

@shilman thanks for publishing the new version, but it seems I cannot install it. The npm error is "No matching version found for @storybook/client-logger@4.0.0-alpha.13". 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.

@baocancode
Copy link

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.

@paxarpp
Copy link
Author

paxarpp commented Jul 10, 2018

the problem is solved:
helped to install the core-js v2.5.7
npm i core-js -save-dev

@paxarpp paxarpp closed this as completed Jul 10, 2018
@shilman
Copy link
Member

shilman commented Jul 10, 2018

@swernerx Based on @paxarpp 's comment above it looks like the Storybook upgrade to dotenv-universal@1.7.0 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!

@shilman shilman reopened this Jul 10, 2018
@swernerx
Copy link
Contributor

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.

@swernerx
Copy link
Contributor

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

@shilman
Copy link
Member

shilman commented Jul 10, 2018

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!

@paxarpp
Copy link
Author

paxarpp commented Jul 11, 2018

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.

swernerx added a commit to sebastian-software/babel-preset-edge that referenced this issue Jul 11, 2018
@swernerx
Copy link
Contributor

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.

  • babel-preset-env: requires "core-js"
  • babel-transform-runtime-helpers: requires "@babel/runtime".

I'll add these to the dependencies correctly and publish a new version.

@swernerx
Copy link
Contributor

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.

@paxarpp
Copy link
Author

paxarpp commented Jul 11, 2018

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?

@sareh
Copy link

sareh commented Jul 11, 2018

@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?

@joepuzzo
Copy link

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/ ?

@shilman
Copy link
Member

shilman commented Jul 12, 2018

@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

@paxarpp
Copy link
Author

paxarpp commented Jul 12, 2018

thanks a lot, update to alpha.14 is all working

@shilman
Copy link
Member

shilman commented Jul 12, 2018

Awesome. Thanks so much everybody! Closing this. 👍

@shilman shilman closed this as completed Jul 12, 2018
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

10 participants