Error occurs when trying to run gulp
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
I was learning JavaScript by the book "Learning JavaScript. 3rd Edition" And although I was doing everything as in the book I still got errors. Right now it is:
> [17:48:13] SyntaxError in plugin "gulp-babel"
Message:
C:\Users\archi\test\lj\public\es6\test.js: Unexpected token
Please, if someone could help me to figure this out?
Thank you in advance
Here is package.json
```
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"babel": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0"
}
```
test.js
```
'use strict';
// es6 feature: block-scoped "let" declaration
const sentences = [
{ subject: 'JavaScript', verb: 'is', object: 'great' },
{ subject: 'Elephants', verb: 'are', object: 'large' },
];
// es6 feature: object destructuring
function say({ subject, verb, object }) {
//es 6 feature: template strings
console.log(`${subject} ${verb} ${object}`);
}
//es6 feature for..of
for(let s of sentences) {
say(s);
}
```
gulpfile.babel.js
```
const gulp = require('gulp');
const babel = require('gulp-babel');
gulp.task('default', function() {
gulp.src("es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("dist"));
gulp.src("public/es6/**/*.js")
.pipe(babel())
.pipe(gulp.dest("public/dist"))
});
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the error with the provided package.json and gulpfile.babel.js, then inspect how gulp-babel processes public/es6/test.js. Check whether the reported Unexpected token occurs at the shown destructuring or template-string syntax. Done means the gulp command completes without the syntax error and writes the expected output to public/dist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100