简体   繁体   中英

'Use of const in strict mode' error while trying gulp build for installing Semantic UI

I am trying to install Semantic UI on ubuntu. I was following the commands on the official site but when i try to

gulp build

it doesn't complete the installation, instead gives out the following error :

/home/krash/node_modules/gulp-chmod/index.js:2
const through = require('through2');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/krash/semantic/tasks/watch.js:14:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

I tried

 gulp build --harmony

as it was mentioned on some other answer with a similar error, it gave out another error

/home/krash/node_modules/gulp-chmod/index.js:6
const defaultMode = 0o777 & (~process.umask());
                ^
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/krash/semantic/tasks/watch.js:14:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

What am i doing wrong?

What version of node are you running? Can you update your version of node? If you can't update your node version, you might have to use babel to transpire your gulp file and then execute the transpiled code.

Also, if you are using a module system, 'use strict' is no longer needed with es6.

first you should install through2 npm install through2 --save-dev

After gulp build --harmony

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM