我是否使用了错误版本的某些包,或者您可以向我发布详细教程或代码笔的链接,其中这种语法构造不会给我一个错误?
我收到此错误:
$ gulp
D:\GIT\project02\gulpfile.js:20
const { COMPATIBILITY, PORT, UNCSS_OPTIONS, PATHS } = loadConfig();
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at execute (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\gulp-cli\lib\versioned\^4.0.0-alpha.2\index.js:36:18)
at Liftoff.handleArguments (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\gulp-cli\index.js:172:63)
at Liftoff.<anonymous> (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\gulp-cli\node_modules\liftoff\index.js:198:16)
我已经阅读了这个问题,但是'use strict';
在我的 gulpfile 中,并且将 const 更改为 let 对我没有用。
我的全局安装包:
$ npm -g ls --depth=0
C:\Documents and Settings\Administrator\Application Data\npm
├── babel-cli@6.14.0
├── babel-core@6.14.0
├── babel-preset-es2015@6.14.0
├── bower@1.7.9
├── gulp-babel@6.1.2
└── gulp-cli@1.2.2 (git://github.com/gulpjs/gulp-cli.git#9b053ed9b7a63a10777c33b86b04ed38d7f5b840)
我的节点是v4.0.0
我在项目中使用的 gulp:
$ gulp -v
[14:15:06] CLI version 1.2.2
[14:15:06] Local version 4.0.0-alpha.2