简体   繁体   English

尝试使用gulp构建安装语义UI时出现“在严格模式下使用const”错误

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

I am trying to install Semantic UI on ubuntu. 我正在尝试在ubuntu上安装语义UI。 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. 如果您无法更新节点版本,则可能必须使用babel来蒸发gulp文件,然后执行已转换的代码。

Also, if you are using a module system, 'use strict' is no longer needed with es6. 另外,如果您使用的是模块系统,则es6不再需要“严格使用”。

first you should install through2 npm install through2 --save-dev 首先,您应该安装through2 npm install through2 --save-dev

After gulp build --harmony 大吃一惊之后-和谐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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