0

I am pretty new to npm and nodejs. what does the output mean? How to debug?

some version info:

10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + which node
10:29:33 /usr/bin/node
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + /usr/local/n/versions/node/5.5.0/bin/node --version
10:29:33 v5.5.0
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + node -v
10:29:33 v0.10.37
10:29:33 + echo ==========================+
10:29:33 ==========================+
10:29:33 + /usr/local/n/versions/node/5.5.0/bin/npm --version
10:29:33 3.3.12
10:29:33 + echo ==========================+
10:29:33 ==========================+

...

error output:

10:30:42 + /usr/local/n/versions/node/5.5.0/bin/npm run build
10:30:43 
10:30:43 > myproject@1.0.0 build /tmp/3791.work
10:30:43 > gulp && webpack
10:30:43 
10:30:43 
10:30:43 /tmp/3791.work/gulpfile.js:30
10:30:43 gulp.task( 'sass', () => {
10:30:43                     ^
10:30:43 SyntaxError: Unexpected token )
10:30:43     at Module._compile (module.js:439:25)
10:30:43     at Object.Module._extensions..js (module.js:474:10)
10:30:43     at Module.load (module.js:356:32)
10:30:43     at Function.Module._load (module.js:312:12)
10:30:43     at Module.require (module.js:364:17)
10:30:43     at require (module.js:380:17)
10:30:43     at Liftoff.handleArguments (/tmp/3791.work/node_modules/gulp/bin/gulp.js:116:3)
10:30:43     at Liftoff.<anonymous> (/tmp/3791.work/node_modules/liftoff/index.js:192:16)
10:30:43     at module.exports (/tmp/3791.work/node_modules/flagged-respawn/index.js:17:3)
10:30:43     at Liftoff.<anonymous> (/tmp/3791.work/node_modules/liftoff/index.js:185:9)
10:30:43 
10:30:43 npm ERR! Linux 3.2.0-34-virtual
10:30:43 npm ERR! argv "/usr/local/n/versions/node/5.5.0/bin/node" "/usr/local/n/versions/node/5.5.0/bin/npm" "run" "build"
10:30:43 npm ERR! node v5.5.0
10:30:43 npm ERR! npm  v3.3.12
10:30:43 npm ERR! code ELIFECYCLE
10:30:43 npm ERR! myproject@1.0.0 build: `gulp && webpack`
10:30:43 npm ERR! Exit status 8

part of gulpfile.js:

 30 gulp.task( 'sass', () => {
 31   config.sass.targets.forEach( target => {
 32     gulp.src( target.src )
 33       .pipe( sass( config.sass.options ) )
 34       .pipe( gulp.dest( target.dest ) );
 35   });
 36 });
BAE
  • 8,550
  • 22
  • 88
  • 171

1 Answers1

0

The arrow-functions (they are part of es2015) are disabled by default in node 0.10-0.12 and enabled in 5.5

You have got the error in connection with an unsupported syntax of-arrow functions in node 0.10.

To put it simply, when you run gulp, then node gulp is run. You showed that which node gives path to node 0.10, so gulp always runs under it.

Solution

/usr/local/n/versions/node/5.5.0/bin/node $(which gulp)

Vlad Churakov
  • 350
  • 2
  • 7
  • I updated my post and posted all gulp related statements. I have no idea how to specify the node version for gulp. – BAE Jan 26 '16 at 18:49
  • @BAE, Gulp should be installed globally and locally at the same time. In our case on our ci-server we have gulp, which is installed globally and we do every building `npm install --dev && gulp` – Vlad Churakov Jan 26 '16 at 19:01