Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

NPM Install does not produce wwwroot and npm run serve errors out

I am on a Mac and not sure what I am doing wrong, but I downloaded both the project starter zip from Teacher's Notes about 10 times, extracted it, pathed into the directory and ran VSCode from it. I would run npm install (which would fail unless I added a sudo to it). While trying to follow along with the video I noticed that the wwwroot folder was missing. I tried to run npm run build anyway, only to receive a list of errors and failures.

After doing this so many times I literally needed to walk away from my laptop out of frustration, I tried downloading the project files from the downloads tab of the video. I tried following along with the video using every single folder as the project folder and could not get a single one to compile and run the dev server. I am beyond frustrated and not really sure how to proceed seeing as the files I need to follow along don't work at all.

Below is the output of the log file produced when the npm run serve fails.

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'serve' ] 2 info using npm@2.15.9 3 info using node@v4.5.0 4 verbose run-script [ 'preserve', 'serve', 'postserve' ] 5 info preserve photoblog@ 6 info serve photoblog@ 7 verbose unsafe-perm in lifecycle true 8 info photoblog@ Failed to exec serve script 9 verbose stack Error: photoblog@ serve: webpack-dev-server --config config/develop.config.js --inline --progress --port 8080 9 verbose stack Exit status 1 9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16) 9 verbose stack at emitTwo (events.js:87:13) 9 verbose stack at EventEmitter.emit (events.js:172:7) 9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14) 9 verbose stack at emitTwo (events.js:87:13) 9 verbose stack at ChildProcess.emit (events.js:172:7) 9 verbose stack at maybeClose (internal/child_process.js:829:16) 9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) 10 verbose pkgid photoblog@ 11 verbose cwd /Users/Jake/Downloads/photo_blog 12 error Darwin 15.6.0 13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve" 14 error node v4.5.0 15 error npm v2.15.9 16 error code ELIFECYCLE 17 error photoblog@ serve: webpack-dev-server --config config/develop.config.js --inline --progress --port 8080 17 error Exit status 1 18 error Failed at the photoblog@ serve script 'webpack-dev-server --config config/develop.config.js --inline --progress --port 8080'. 18 error This is most likely a problem with the photoblog package, 18 error not with npm itself. 18 error Tell the author that this fails on your system: 18 error webpack-dev-server --config config/develop.config.js --inline --progress --port 8080 18 error You can get information on how to open an issue for this project with: 18 error npm bugs photoblog 18 error Or if that isn't available, you can get their info via: 18 error 18 error npm owner ls photoblog 18 error There is likely additional logging output above. 19 verbose exit [ 1, true ]

Any help would be VERY much appreciated

1 Answer

Seth Kroger
Seth Kroger
56,403 Points

I think the main problem is this: "I would run npm install (which would fail unless I added a sudo to it). " You don't own or have the file permissions for the directory you extracted or where you extracted it. First make sure you extracted the zip file to somewhere under your home directory, not under root or somewhere else. Then double-check the ownership and permissions.