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 Angular Basics Setting Up an Angular Application Your First Angular Application

SyntaxError: Unexpected token ... at /config/common.config.js:13 return path.join.apply(path, [ROOT, ...pathParts]);

After I downloaded all the files and ran npm install I get this error:

/Applications/MAMP/htdocs/photo_blog/config/common.config.js:13 return path.join.apply(path, [ROOT, ...pathParts]); ^^^

SyntaxError: Unexpected token ... at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.<anonymous> (/Applications/MAMP/htdocs/photo_blog/config/release.config.js:5:22) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10)

82051 verbose cwd /Applications/MAMP/htdocs/photo_blog 82052 error Darwin 14.5.0 82053 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--build-from-source" 82054 error node v4.3.2 82055 error npm v2.14.12 82056 error code ELIFECYCLE 82057 error photoblog@1.0.0 postinstall: npm run build 82057 error Exit status 1 82058 error Failed at the photoblog@1.0.0 postinstall script 'npm run build'. 82058 error This is most likely a problem with the photoblog package, 82058 error not with npm itself. 82058 error Tell the author that this fails on your system: 82058 error npm run build 82058 error You can get their info via: 82058 error npm owner ls photoblog

Anybody else came across this?

Sam Peppard
Sam Peppard
3,561 Points

I have the same problem. Trying to figure this out.

1 Answer

Nathan Monte
Nathan Monte
16,643 Points

I have changed the code in config/common.config.js to this, which appears to have fixed the issue. It appears the spread operator wasn't working for me.

function root(pathParts) {
  if (typeof pathParts === 'string') {
    pathParts = pathParts.split('/');
  }
  var arr = [ROOT].concat(pathParts);
  return path.join.apply(path, arr);
}

Works for me too. Thanks for sharing!