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 Compile Sass with Gulp Add Source Maps to your SaSS

Harpreet Singh
Harpreet Singh
3,830 Points

Sourcemaps not working - Gulp

Getting this error when trying to work with sourcemaps and Gulp:

Gulp Lessons - Add source maps to your Sass.

Harpreets-MacBook-Pro:css harpreetsingh$ gulp compileSass
[14:15:27] Working directory changed to ~/Desktop/Stage1Video3
/Users/harpreetsingh/Desktop/Stage1Video3/node_modules/gulp-sourcemaps/node_modules/strip-bom/index.js:2
module.exports = x => {
                   ^^
SyntaxError: Unexpected token =>
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478: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 Object.<anonymous> (/Users/harpreetsingh/Desktop/Stage1Video3/node_modules/gulp-sourcemaps/src/init/index.internals.js:7:16)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
Harpreets-MacBook-Pro:css harpreetsingh$

1 Answer

Hi Harpreet Singh,

I had the same problem. This error is caused by using an older version of Node. The Strip-bom module is now using ES2015 (ES6) syntax which requires Node 5.0+. (See Node's ES2015 support list here)

To test your version of Node, run:

node -v

If it's less than 5.0, you'll need to update it. You can download the newest version of Node here:

https://nodejs.org/en/

If the gulp command gives a "gulp: command not found" in your console. You should install gulp globally and it is fixed ;)

Hope this helps!

Cheers!