Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Welcome to Gulp.js Your First Gulp Task

rob111
rob111
8,379 Points

Trying to run "gulp hello" but get error message

When I run "gulp hello" in console I get this error message

bash-3.2$ gulp hello
/Users/RR/Downloads/Stage1Video3/gulpfile.js:5
gulp.task("hello", fucntion() {
                           ^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)

here is my gulpfile.js file:

'use strict';

var gulp = require('gulp');

gulp.task("hello", fucntion() {
    console.log("hello");
});

here is my package.json file:

{
  "name": "treehouse-test",
  "version": "1.0.0",
  "description": "Code for my Treehouse Gulp.js course!  June, 2015.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^3.9.1"
  }
}

2 Answers

rob111
rob111
8,379 Points

I didn't spell function right in my gulpfile.js

Quinn Zepeda
Quinn Zepeda
15,175 Points

I had an issue, where I was doing everything right but i needed to also install gulp-cli globally to be able to have gulp hello not give me this error "gulp : The term 'gulp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • gulp hello
  • ~~~~
    • CategoryInfo : ObjectNotFound: (gulp:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException"