https://github.com/nuxt/nuxt.js
just remove your node_modules and npm install and npm run build
build success
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
....
this maybe caused by babel use core-js@3
i hate @cmty no one answer anything there and not on the search on google :S stop closing issues
@bimohxh did you find any solution for it ?
any solution for this
@heshamelmasry77 clean lock file and node modules and resintall, if it dont help -> add core-js@2 at your project
Same issue with nuxt 2.6.1. "core-js": "^2.6.5" fixed the issue
yarn add core-js
如果还不行
删除 node_modules,然后使用 yarn 安装,不要使用 cnpm 安装;
不要用 cnpm,换成 npm 即可
package.json
"dependencies": {
"core-js": "^2.6.5",
"nuxt": "2.6.3",
...
},
It works!
I just updated the dependencies and I get this error
@riux try @yoelnacho answer. I had to yarn add [email protected]
(v3 does not seem to be supported).
I still got this error. Adding core-js manually is not the best option since it breaks modern build @pi0 any advices?
Having the same issue on my deployment server..., even adding core-js manually won't work for me.
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 [email protected] --save
However, 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.
Same here! Why is this closed? 🤔
I keep getting this error randomly in various long-running projects, usually after upgrading nuxt. Just got it again after upgrading to v2.11.0
.
Using npm or yarn, deleting node_modules and the lock file, all did not work except manually installing core-js v2 like mentioned above.
Is there an official solution for this problem? I get it for months now randomly.
I have only done what they propose here and everything works perfectly in 2.11.0 👍
@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
build: {
babel: {
configFile: "./babel.config.js"
}
}
babel.config.js
module.exports = function(api) {
return {
presets: [
[
"@nuxt/babel-preset-app",
{
corejs: { version: 3 }
}
]
]
};
};
Same here on 2.11 with yarn build
. It works with adding core-js but is there any info why it's necessary to add core-js@x ?
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.
Hey Guys,
After adding "core-js": "^2.6.5" , I am getting error
[Vue warn] The .native modifier for v-on is only valid on components but it was used on .
Please advise.
Anil
I've deleted the yarn-lock.json file and i ran "yarn" again. It worked.
I noticed the error occured when i upgraded some dependecies like bootstrap-vue from 2.0.0 to 2.9.0 and nuxt from 2.0.0 to 2.12.1
yarn add core-js@2
did the trick
Getting the same error after adding firebase
Removing node_modules
then yarn
did not work
yarn add core-js@2
worked though
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
Guys, following the docs resolved the issue: https://nuxtjs.org/guide/release-notes#v2.6.0
yarn add -D core-js@3 @babel/runtime-corejs3
# or
npm i -D core-js@3 @babel/runtime-corejs3
Then edit nuxt.config.js
.
export default {
build: {
babel: {
presets({ isServer }) {
return [
[
require.resolve('@nuxt/babel-preset-app'),
// require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
{
buildTarget: isServer ? 'server' : 'client',
corejs: { version: 3 }
}
]
]
}
}
}
}
Can verify @jjangga0214 solution works. Thank you.
After install core-js@3 @babel/runtime-corejs3
my PM2 Just break :/
@isuke01
https://nuxtjs.org/guide/release-notes#core-js
Install Core JS v2, not 3
Getting the same error after adding
firebase
Removing
node_modules
thenyarn
did not work
yarn add core-js@2
worked though
Thank you! Works :)
It's still not ideal:
warning [email protected]: core-js@<3 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.
yeah, I just encountered this issue too :/
Guys, follow the docs to resolve the issue: https://nuxtjs.org/guide/release-notes#v2.6.0
yarn add -D core-js@3 @babel/runtime-corejs3 # or npm i -D core-js@3 @babel/runtime-corejs3
Then edit
nuxt.config.js
.export default { build: { babel: { presets({ isServer }) { return [ [ require.resolve('@nuxt/babel-preset-app'), // require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users { buildTarget: isServer ? 'server' : 'client', corejs: { version: 3 } } ] ] } } } }
Solution works
Hi @lil-armstrong thanks for the links! I appreciate it!
For me I encountered this issue after I upgrade some dependencies using yarn add xxx@latest
. I solved this by running npm install
after the upgrading (without deleting yarn.lock
or package-lock.json
). I think this issue may be related to yarn
..
Edit: @jjangga0214 is right. Just checkout which version of core-js has been installed in the node_modules
and specify the actual core-js version in build.babel
in nuxt.config.js
. Since Nuxt 2.6 it supports both v2 and v3 of core-js. But by default it's v2 so if any dependency causes v3 installed you have to tell Nuxt through that config option.
if you are using Yarn you can add resolutions to your package.json like so
"resolutions": {
"core-js": "2.6.11"
}
Same issue with nuxt 2.6.1. "core-js": "^2.6.5" fixed the issue
how did you fixit?
remove node_modules and lock file then install dosen't work, but npm install core-js@2 works
Most helpful comment
i hate @cmty no one answer anything there and not on the search on google :S stop closing issues