General Discussion Automating Your Development with webpack Dev Server

Vang Nguyen
PRO
Vang Nguyen
Pro Student 429 Points

The lesson doesn't build or start the webpack-dev-server

An instructor needs to give clear and instructions on getting the project bulding and webpack-dev-server starting. I've followed through the confusing amount of suggestions on in the questions section and nothing has worked. Is this the reality of working with nodejs, a nightmare of dependency conflicts and searching for compatible packages.

2 Answers

Simon Olsen
Simon Olsen
3,597 Points

I have also followed lots of suggestions in the Questions here and nothing is working. I'm at a point where, if I install the latest webpack...

$ npm install --save-dev webpack@latest
npm WARN babel-loader@6.4.1 requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none is installed. You must install peer dependencies yourself.
npm WARN html-webpack-plugin@2.30.1 requires a peer of webpack@1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@4.1.1 requires a peer of webpack@^2 || ^2.2.0-rc.0 || ^2.1.0-beta || ^1.12.6 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-treehouse-example@0.0.1 No repository field.
npm WARN webpack-treehouse-example@0.0.1 No license field.

+ webpack@4.8.3
added 56 packages from 62 contributors, removed 32 packages, updated 3 packages and audited 18787 packages in 17.338s
found 0 vulnerabilities

...so I read this that I need Webpack ^2, but when I install that...

$ npm install --save-dev webpack@^2
npm WARN webpack-cli@2.1.4 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@3.1.3 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server@3.1.4 requires a peer of webpack@^4.0.0-beta.1 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-treehouse-example@0.0.1 No repository field.
npm WARN webpack-treehouse-example@0.0.1 No license field.

+ webpack@2.7.0
added 31 packages from 82 contributors, removed 59 packages, updated 4 packages and audited 17190 packages in 10.502s
found 0 vulnerabilities

...so no luck either way.

I've got the path module installed and webpack.config.js updated, as per Craig Curtis' instructions, I've also removed loaders: in favour of rules: as per Brian Cortes' post.

I've dealt with the mode: production issue by adding the following to webpack.config.js

mode: "development",

And npm start STILL doesn't work...

It's pretty clear from all the questions/comments on this video that the dependencies need to be updated. Yes, npm modules get regular (read: daily!) updates, but this lesson simply can't be completed.

I'm not suggesting the videos be re-recorded, but SURELY the git repo can be updated so this lesson's project files actually work! This is no freeby tutorial on YouTube - we're forking out, monthly, for these courses.

Joel Jordan
PRO
Joel Jordan
Pro Student 6,561 Points

I ended up uninstalling the webpack-dev-server and running the npm install --save-dev webpack-dev-server@1.13.0 and that did the trick. I noticed in lesson 03 the webpack-dev-server version under "devDependencies" was 1.13.1. When I tried to load that I got an error and when I ran the "npm view webpack-dev-server versions" command it showed there was no 1.13.1 so I installed 1.13.0 and that did the trick.

Tyler Lowrey
Tyler Lowrey
14,484 Points

This fixed it for me, thanks!