nuxt: core-js problems with 2.5.0

Version

v2.5.0

Reproduction link

http://not-needed.com

Steps to reproduce

Do the fresh install of the Nuxt(via cli) with the following options:

  • Project name project
  • Project description Cool project
  • Use a custom server framework none
  • Choose features to install Axios
  • Use a custom UI framework element-ui
  • Use a custom test framework none
  • Choose rendering mode Universal
  • Author name Andrew Gorpenko
  • Choose a package manager npm

After running the npm run dev I am getting the error:

 ERROR  Failed to compile with 3 errors

These dependencies were not found:
* core-js/library/fn/object/assign in ./node_modules/babel-runtime/core-js/object/assign.js
* core-js/library/fn/symbol in ./node_modules/babel-runtime/core-js/symbol.js
* core-js/library/fn/symbol/iterator in ./node_modules/babel-runtime/core-js/symbol/iterator.js

What is expected ?

Clean install without errors

What is actually happening?

Fails to compile because of missing dependencies

<div align="right">This bug report is available on Nuxt community (#c8883)</div>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

For the benefit of people coming here from search engine, this error can trigger depending on what dependencies one has installed and can be fixed by explicitly installing core-js@2 dependency.

We are having similar issues with upgrading from 2.4.5 to 2.5.0 when building the BootstrapVue docs:

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at r (/root/bootstrap-vue/node_modules/vue-server-renderer/build.dev.js:9295:16)
    at Object.<anonymous> (webpack:/external "@babel/runtime/helpers/esm/asyncToGenerator":1:0)
    at o (webpack/bootstrap:36:0)
    at Module.<anonymous> (.nuxt/middleware.js:1:19)
    at o (webpack/bootstrap:36:0)
    at Object.<anonymous> (node_modules/@nuxt/webpack/node_modules/core-js/internals/own-keys.js:4:43)
    at o (webpack/bootstrap:36:0)

And getting warning about core-js version not being specified:

WARNING: We noticed you're using the useBuiltIns option without declaring a core-js version.
Currently, we assume version 2.x when no version is passed. Since this default version will
likely change in future versions of Babel, we recommend explicitly setting the core-js
version you are using via the corejs option.

You should also be sure that the version you pass to the corejs option matches the version
specified in your package.json's dependencies section. If it doesn't, you need to run one
of the following commands:

  npm install --save core-js@2    npm install --save core-js@3
  yarn add core-js@2              yarn add core-js@3

The only babel file I have is the .babelrc generated by create-nuxt-app

Sorry if I wasn’t clear before, but I got it working from changing the static class constant to a named const export.

See the before and after in my previous comment, after that change everything is working for me.

@digitalcrafted Do you have a babel.config.js or .babelrc file in your project? Otherwise is there any chance you can share the project with us or giving more details?

PS: Cleaning up yarn.lock/package-lock.json may help.