JavaScript Automating Your Development with webpack Dev Server

John Wilson
John Wilson
11,739 Points

npm start throwing error.

I have installed all the dependencies that this video required, but I am getting the following error when I run my npm script:

module.js:471 throw err; ^

Error: Cannot find module 'webpack/bin/config-yargs' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/johnwilson/Desktop/projects/webpack-trhs/webpack-workshop/node_modules/webpack-dev-server/bin/webpack-dev-server.js:46:1) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v6.9.2 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE npm ERR! webpack-treehouse-example@0.0.1 start: webpack-dev-server npm ERR! Exit status 1 npm ERR!

Any idea?

3 Answers

That's still going to happen if the versions become mismatched. As of the time of this writing Weasley was using WebPack 1.13. The latest Webpack-dev-server has a dependency on WebPack 1.15 or higher. If that is the issue, then ...

npm uninstall webpack --save-dev

followed by

npm install webpack --save-dev

That'll solve your problems.

Thomas Hahn
Thomas Hahn
2,627 Points

This did not help. Still I get:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.output.path: The provided value "build" is not an absolute path!

npm ERR! Windows_NT 10.0.15063 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! webpack-treehouse-example@0.0.1 start: webpack-dev-server npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the webpack-treehouse-example@0.0.1 start script 'webpack-dev-server'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the webpack-treehouse-example package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! webpack-dev-server npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs webpack-treehouse-example npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls webpack-treehouse-example npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\Angular\webpack-workshop\npm-debug.log

Brian Cortes
Brian Cortes
294 Points

hello gays , this is my configuration that resolved the problem

 const path = require('path');
 var HtmlWebpackPlugin = require("html-webpack-plugin");

 var webpackConfig = {
    entry: "./src/index.js",
    output: {
        path: path.resolve(__dirname, 'build'),
        filename: "bundle.js"
    },
    module: {
        rules: [
            {
                loader: "babel-loader",
                test: /\.js$/
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "src/index.ejs"
        })
    ]
};

module.exports = webpackConfig;
John Wilson
John Wilson
11,739 Points

Ohh k. I was still on the cloned lesson 03 and did not clone lesson 04....oops, my b.