https://github.com/nuxt/create-nuxt-app
Create a new project using npx and try to build.
A successful build.
Build fails with error:
ERROR in baa9a7368c0a13e03198.js from Terser
TypeError: Cannot read property 'minify' of undefined
at minify (/usr/src/app/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
It looks like this is an upstream issue. After some time spent trying to figure out why my build was failing and not seeing any issues here, I figured I would open one with the link to what I believe the cause to be: https://github.com/webpack-contrib/terser-webpack-plugin/issues/66
Hopefully some other dev is saved some debug time!
backtrace:
ERROR in 70fe8ac2e7db24c37f38.js from Terser
TypeError: Cannot read property 'minify' of undefined
at minify (/home/simon/Dev/Web/hokify-pwa/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
at module.exports (/home/simon/Dev/Web/hokify-pwa/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
at handle (/home/simon/Dev/Web/hokify-pwa/node_modules/worker-farm/lib/child/index.js:44:8)
at process.
at process.emit (events.js:188:13)
at emit (internal/child_process.js:828:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
terser is accessed via ".default".. which is not defined though. If you change the line to (/home/simon/Dev/Web/hokify-pwa/node_modules/terser-webpack-plugin/dist/minify.js:175)
const {
error,
map,
code,
warnings
} = _terser.minify({
[file]: input
}, terserOptions);
thinks work again..
Adding
"resolutions": {
"terser": "3.14.1"
}
to package.json
helped me to successfully $ yarn build
until this is fixed.
Similarly, hardcoding a dependency in my package.json worked for npm.
"dependencies":{
...
"terser": "3.14.1"
}
On Sat, 2 Feb 2019, 19:08 Marco Ehrenmann <[email protected] wrote:
Adding
"resolutions": {
"terser": "3.14.1"
}to package.json helped me to successfully $ yarn build until this is
fixed.โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nuxt/nuxt.js/issues/4931#issuecomment-459990777, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AGKQ68E-_fV6f9NG2jrVs7Bw4k175eokks5vJeIlgaJpZM4afsTd
.
@stepbeek Can you use yarn why terser
and paste the result here ? It seems that something installed [email protected]
and made somehow Nuxt use it instead of [email protected]
.
Thanks @mauxtin. Fix on his way : https://github.com/terser-js/terser/pull/254
But the issue it not around Nuxt dependencies, it's around a module/option selected through create-nuxt-app
which depends on terser
and probably updated it to last minor version under a patch version.
But I can't easily find which one, I would need someone with the issue to do yarn why terser
.
@kevinmarrec "nuxt#@nuxt#webpack#terser-webpack-plugin"
depends on it
@marcoeh Yeah thanks, just got that from yarn.lock
:
terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.2.1.tgz#7545da9ae5f4f9ae6a0ac961eb46f5e7c845cc26"
integrity sha512-GGSt+gbT0oKcMDmPx4SRSfJPE1XaN3kQRWG4ghxKQw9cn5G9x6aCKSsgYdvyM0na9NJ4Drv0RG6jbBByZ5CMjw==
dependencies:
cacache "^11.0.2"
find-cache-dir "^2.0.0"
schema-utils "^1.0.0"
serialize-javascript "^1.4.0"
source-map "^0.6.1"
terser "^3.8.1"
webpack-sources "^1.1.0"
worker-farm "^1.5.2"
terser@^3.8.1:
version "3.16.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-3.16.0.tgz#04028e6e5da461d91691cedd75fa53a17f2f20d9"
integrity sha512-Ua8BhyibmsQBFXDZZ3Es7GASB2yFrQJr0jgAlZK1FBLbFarrHoCuMHPCro5MbX4jidcaFGiV+uTc3wxodmGjUg==
dependencies:
commander "~2.17.1"
source-map "~0.6.1"
source-map-support "~0.5.9"
I have the same issue! But with my current app, after I build it. I updated Nuxt and now I have this
ERROR in 22a950141f51121d5985.js from Terser
TypeError: Cannot read property 'minify' of undefined
And I also have font loader errors.
None of the mentioned solutions work for me, I just started an app with npx create-nuxt-app
$ npm ls terser
[email protected] /home/iom/code/app
โโโฌ [email protected]
โโโฌ @nuxt/[email protected]
โโโฌ [email protected]
โโโ [email protected]
$ yarn why terser
yarn why v0.27.5
[1/4] Why do we have the module "terser"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
info This module exists because "nuxt#@nuxt/webpack#terser-webpack-plugin" depends on it.
info Disk size without dependencies: "3.85MB"
info Disk size with unique dependencies: "4.84MB"
info Disk size with transitive dependencies: "4.85MB"
info Number of shared dependencies: 4
Done in 0.71s.
Edit: I was able to work around this by editing my yarn.lock file to resolve to the older version.
Still no fix, what a joke :smile:
Have a productive week, guys
@marcoeh you have something to tell me? Or you think it's normal to break millions of apps by not providing default export
and not fixing it for days (it's will take like 15 minutes)? Everything not working, from create-react-app
to Nuxt. All because of some dude forget to make default export
.
@bdrtsk If it will take 15 minutes, raise a PR yourself.
Even better, it's already in progress :smiley:
@robcresswell yeah, PR :smile: It doesn't merged, that's the whole point. It's in progress for a 2 days already.
@marcoeh so? Let's break everything and then tell about personal life? If whole webpack ecosystem depends on that module, then why he's the only one who reviews PR's. You really think this is normal?
After watching Vuemastery tutorial about Nut I am trying to run npx create-nuxt-app
and it's not working. Is this because of that? Can't understand (my first try of Nuxt)
@pavlushacoder that's an unfortunate first experience. I suggest you to wait a fix and then try again.
The root of problem is Terser, most if not all packages that depends on Terser have their build broken, Nuxt isn't the only one. A quick fix is to downgrade Terser's version by adding "terser": "3.14.1"
in your dependencies. Please take a look at Terser's issues: https://github.com/terser-js/terser/issues
This is funny, since I also just tried to install Nuxt for the first time :smile:
@HoraceKeung did you tried it? We don't have Terser as dependency. This is dependency of dependency.
Sorry, I should have said it better, Nuxt does not directly depend on Terser, but Nuxt depends on something that depends on Terser. I had the same issue on Saturday, spent 2-3 hours looking for a fix, then I see Terser released 3.16.0 on Saturday (https://www.npmjs.com/package/terser), after reading a bit more, I tried adding "terser": "3.14.1"
in my dependencies, and it worked.
The problem is he should have make it a major release i.e. make it version 4.0.0 then I believe none of these will happen.
Okay, we got it. Now calm down everybody ๐
A few things you guys should consider:
https://github.com/terser-js/terser/issues/251 / https://www.npmjs.com/package/terser/v/3.16.1
Terser v3.16.1
resolves the issue
"resolutions": {
"@nuxt/**/terser": "3.14.1"
}
try this ? i resolved
Most helpful comment
Okay, we got it. Now calm down everybody ๐
A few things you guys should consider:
TL;DR