gulp build can't complete the 'build-assets' phase due to the following error:
GulpUglifyError: unable to minify JavaScript
Caused by: DefaultsError: `preserveComments` is not a supported option
semantic/tasks/config/tasks.js:96
if(error.filename.match(/theme.less/)) {
^
TypeError: Cannot read property 'match' of undefined
And is NOT fixed by commenting the following lines:
./tasks/config/tasks.js:148: preserveComments : 'some'
./tasks/config/tasks.js:162: preserveComments : false
Steps to reproduce it:
npm install semantic-ui --save
cd semantic/
gulp build
would also like to see this answered as i am having the same issue. 鈱涳笍
i tried to resolve this by downloading the semantic zip from the website.
although this zip does not contain everything and will still error out giving the following
This relative module was not found: *./themes/default/assets/images/loader-large.gif in ./~/css-loader?{"minimize":false,"sourceMap":false}!./semantic/dist/semantic.min.css
@simoncarbajal i fixed this by completely removing semantic and reinstalling it. not sure where the cause lies. :man_shrugging:
Fix is to change filename to fileName in line 96 of semantic/tasks/config/tasks.js
e.g. if(error.fileName.match(/theme.less/)) {
@tarkwyn Can you make a pull request to fix this?
I can confirm that @tarkwynl 's change worked for me. I can provide additional details if needed.
The camelCase issue didn't cause any problems, however I was unable to successfully gulp build until I commented out the two preserveComments tags in /semantic/tasks/config/tasks.js
The error (with "gulp-uglify": "^3.0.0"):
[13:56:35] Created: dist/components/site.js
[13:56:35] Plumber found unhandled error:
GulpUglifyError: unable to minify JavaScript
Caused by: DefaultsError: `preserveComments` is not a supported option
File: /Volumes/DATA/WWW/skilled/semantic/dist/components/site.js
@neokio I also received the perserveComments error, but I had to upgrade my version of node to the latest, to get pass that.
I will not very experienced with gulp/node so take my inputs with a grain of salt.
Interesting! Good advice in general, so I updated node from 7.7.1 to the latest (8.1.3), and reinstalled npm (npm install -g npm) just to be sure.
The above error still appears, unless I remove both perserveComments.
The error persists in 2.2.11 ... unable to successfully gulp build until I removed both preserveComments lines from /semantic/tasks/config/tasks.js.
@neokio could be unrelated, but when I said I updated to the latest for Node Js I actually went for LTS, not current. https://nodejs.org/en/ so I went on version 6.11.1
I think I found the problem. This issue ... https://github.com/terinjokes/gulp-uglify/issues/265 ... and the latest gulp-uglify release notes reveal that release v3.0.0 of gulp-uglify REMOVED the custom option preserveComments :)
Yep, can confirm the issue. Commenting out L148 & L162 (temporarily) solves it.
Tried with older version of Node / npm & latest version too.
It's not camelCase related or node version related
After all, what will be done in the semantic ui ? To remove the option or comment and wait for uglify downgrade ?
I'll fix the dependencies so that we dont use this version of uglify. Sorry about this guys.
I'm a little late to the party, but I figure another confirmation can't hurt. Commenting out L148 & L162 worked for me as well. Thanks!
Commenting out L148 & L162. It worked for me too.
Commenting out L148 & L162. It worked for me too.
Commenting out only worked , can't find out if issue is in gulp-uglify or semantic ui.
Will get fix in over weekend. Thanks for patience.
Commenting worked for me, too. Glad I wasn't the only one with this problem, since I'm new to semantic ui and gulp--and I'm on a time crunch! Thanks guys!
Hi, I found that Uglify plugin changed its options and now preserveComments is obsolete:
https://github.com/gruntjs/grunt-contrib-uglify#deprecated-options-from-2x
Option | Replacement
preserveComments | output.comments
So, just replacing in these 2 lines in semantic/tasks/config/tasks.js:
./tasks/config/tasks.js:148: preserveComments : 'some'
./tasks/config/tasks.js:162: preserveComments : false
with:
output: {
comments: 'some'
}
output: {
comments: false
}
worked for me.
@sergiomar73 Thanks this fixed it
@sergiomar73 Thanks man, I can confirm this fixes it.
@sergiomar73 I confirm it too.
@sergiomar73 It worked. Thanks!
A weekend late but pushing this now.
What's the timeline for releasing 2.2.12, @jlukic?
It's kind of too bad that we have to wait until v2.2.12 is released to see this bug fixed :/
This is a blocking issue for the one who doesn't patch manually and needs to use gulp (sometimes you have to). Wouldn't a v2.2.11.1 be a better solution? Just asking.
@cluxter dont worry, I'm releasing this later tonight. Continuing to jam on issues. Manual fix above should work in interim.
Hmm, still getting this error with v2.2.12:
[15:23:13] Plumber found unhandled error:
GulpUglifyError: unable to minify JavaScript
Caused by: DefaultsError: `comments` is not a supported option
File: /home/axper/project/semantic/dist/components/sticky.js
Hi @jlukic , I tried build a test of semantic and the same problem occured. The file tasks.js
already in the new version, with your last commit. I had to apply the solution that @sergiomar73 showed.
I tried build in 2.2.11 and 2.2.12.
Patch incoming
And out 2.2.13
Hi, @jlukic
I have installed de last updates (2.2.13) of semantic and tried build the project.
The fix worked succefully.
Thanks a lot.
Sorry about mistakes with the first fix.
v2.2.13 works on my side. Thanks a lot @jlukic !
Hi, I've been having the exact same issue with 2.2.13.
To solve it, I've had to update Node.js & NPM.
It might be obvious... but it wasn't for me :)
Yes, can confirm that default version of nodejs 4.2.6 for ubuntu 16.04 won't work. Needed to upgrade to 6.x.x. Thanks.
Confirmed that it's a problem related to nodejs version. Fixed with:
````
export NODE_VERSION="node-v8.11.1-linux-x64"
cd /opt
wget https://nodejs.org/dist/v8.11.1/$NODE_VERSION.tar.xz
tar xvf $NODE_VERSION.tar.xz
export PATH=$PATH:/opt/$NODE_VERSION/bin:$PWD/node_modules/bower/bin
````
then use node.js as usual.
Remember also to uninstall previous node.js installations
Plumber found unhandled error:
GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: punc ())
Any idea on this?
Most helpful comment
Hi, I found that Uglify plugin changed its options and now preserveComments is obsolete:
https://github.com/gruntjs/grunt-contrib-uglify#deprecated-options-from-2x
So, just replacing in these 2 lines in semantic/tasks/config/tasks.js:
with:
worked for me.