nuxt: Module not found: Error: Can't resolve 'core-js/modules/es6.array.iterator' in '/app/.nuxt'
Version
Reproduction link
https://github.com/nuxt/nuxt.js
Steps to reproduce
just remove your node_modules and npm install and npm run build
What is expected ?
build success
What is actually happening?
build error
Module not found: Error: Can’t resolve ‘core-js/modules/es6.array.iterator’ in ‘/app/.nuxt’ @ ./.nuxt/client.js 15:0-44 @ multi ./.nuxt/client.js[39m[22m
[1m[31mERROR in ./.nuxt/utils.js Module not found: Error: Can’t resolve ‘core-js/modules/es6.date.to-string’ in ‘/app/.nuxt’ @ ./.nuxt/utils.js 6:0-44 @ ./.nuxt/client.js @ multi ./.nuxt/client.js[39m[22m
[1m[31mERROR in ./.nuxt/client.js Module not found: Error: Can’t resolve ‘core-js/modules/es6.function.name’ in ‘/app/.nuxt’ @ ./.nuxt/client.js 14:0-43 @ multi ./.nuxt/client.js[39m[22m
[1m[31mERROR in ./.nuxt/index.js Module not found: Error: Can’t resolve ‘core-js/modules/es6.function.name’ in ‘/app/.nuxt’ @ ./.nuxt/index.js 6:0-43 @ ./.nuxt/client.js @ multi ./.nuxt/client.js[39m[22m …
Additional comments?
this maybe caused by babel use core-js@3
https://github.com/babel/babel/pull/7646
https://github.com/babel/babel/releases/tag/v7.4.1
<div align="right">This bug report is available on Nuxt community (#c8870)</div>About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 11
- Comments: 38 (2 by maintainers)
Commits related to this issue
- Fix issue core-js - https://github.com/nuxt/nuxt.js/issues/5287 - https://nuxtjs.org/guide/release-notes/#core-js — committed to pdt590/prj-xomcho by pdt590 4 years ago
- Fix core.js issue - https://github.com/nuxt/nuxt.js/issues/5287 - https://nuxtjs.org/guide/release-notes/#-code-core-js-2-code- — committed to pdt590/prj-octomaker-blog by pdt590 4 years ago
- fix: add dependency https://github.com/nuxt/nuxt.js/issues/5287#issuecomment-495437917 — committed to IngvarListard/nuxt-django-graphql-example by IngvarListard 4 years ago
- Downgrade core-js https://github.com/nuxt/nuxt.js/issues/5287 — committed to JOWOMO/project-c by mskg 4 years ago
i hate @cmty no one answer anything there and not on the search on google :S stop closing issues
Guys, following the docs resolved the issue: https://nuxtjs.org/guide/release-notes#v2.6.0
Then edit
nuxt.config.js.Same issue with nuxt 2.6.1. “core-js”: “^2.6.5” fixed the issue
package.json
"dependencies": { "core-js": "^2.6.5", "nuxt": "2.6.3", ... },It works!
We were getting the same issue after doing an npm install. The issue started when we installed file-loader for adding a specific sound file. Thereafter, referted back from using file-loader and uninstalled it. We the started getting the error messages of core-js not resolved.
We added core-js manually, however this installed the latest corejs version (3.x) and did not work.
Had to manually add core-js :
npm install core-js@2.6.10 --saveHowever, this is very ‘hacky’ solution since this message appears when installing:
core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.Our project is working now, but for how long untill it is no longer support. It also feels ‘hacky’ since core-js was never required to be manually installed.
Getting the same error after adding
firebaseRemoving
node_modulesthenyarndid not workyarn add core-js@2worked though@wanxe @filrak I solved it by following the steps outlined here: https://www.npmjs.com/package/@nuxt/babel-preset-app#example-2-use-core-js3
In addition, I clean up my nuxt.config.js file by outsourcing the babel config in its own babel.config.js file.
nuxt.config.js
babel.config.js
@riux try @yoelnacho answer. I had to
yarn add core-js@2.6.10(v3 does not seem to be supported).I have only done what they propose here and everything works perfectly in 2.11.0 👍
Solution works
Same here! Why is this closed? 🤔
@heshamelmasry77 clean lock file and node modules and resintall, if it dont help -> add core-js@2 at your project
I just updated the dependencies and I get this error
Simple and painless solution. Just add or update core-js.
for npm:
npm i -S core-js@2.5.7for yarn:
yarn add core-js@2.5.7Thank you! Works 😃
Having the same issue on my deployment server…, even adding core-js manually won’t work for me.
I still got this error. Adding core-js manually is not the best option since it breaks modern build @pi0 any advices?
It’s still not ideal:
Can verify @jjangga0214 solution works. Thank you.
why there no core team answering this problems, like where are they, they supposed to helps us, not to let us fighting this error, I am disappointed
I’ve deleted the yarn-lock.json file and i ran “yarn” again. It worked.
I was having issues using npm. Fix was to remove package.lock, remove node_modules, add “core-js”: “^2.6.5” to deps and run yarn install.
yarn add core-js 如果还不行 删除 node_modules,然后使用 yarn 安装,不要使用 cnpm 安装;