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

Justin Hall
Justin Hall
1,063 Points

Can't run npm install without sudo; npm run serve fails

If I run npm install without sudo I get...

npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

> fsevents@1.1.2 install /Users/justin/Sites2/angular/photo_blog/node_modules/fsevents
> node install

[fsevents] Success: "/Users/justin/Sites2/angular/photo_blog/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> photoblog@ postinstall /Users/justin/Sites2/angular/photo_blog
> npm run build

> photoblog@ build /Users/justin/Sites2/angular/photo_blog
> webpack

/Users/justin/Sites2/angular/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> (/Users/justin/Sites2/angular/photo_blog/config/release.config.js:5:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! photoblog@ build: `webpack`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the photoblog@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justin/.npm/_logs/2017-09-10T20_37_30_210Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! photoblog@ postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the photoblog@ postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justin/.npm/_logs/2017-09-10T20_37_30_353Z-debug.log

If I run npm install with sudo it seems to work:

npm WARN lifecycle photoblog@~postinstall: cannot run in wd %s %s (wd=%s) photoblog@ npm run build /Users/justin/Sites2/angular/photo_blog
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN photoblog@ No repository field.
npm WARN photoblog@ No license field.

up to date in 5.669s

When I run npm run serve with or without sudo, I get this:

> photoblog@ serve /Users/justin/Sites2/angular/photo_blog
> webpack-dev-server --config config/develop.config.js --inline --progress --port 8080

/Users/justin/Sites2/angular/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> (/Users/justin/Sites2/angular/photo_blog/config/develop.config.js:5:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! photoblog@ serve: `webpack-dev-server --config config/develop.config.js --inline --progress --port 8080`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the photoblog@ serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/justin/.npm/_logs/2017-09-10T20_38_13_362Z-debug.log