Nikita Minaev
Nikita Minaev

Reputation: 129

Why webpack not build?

While i build front end in power shell command "webpack" appear this error. Global webpack version "4.22.0" (command below). Local webpack version "4.20.2".

PS D:\ThePlatform\View.WebInterface> npm info webpack version
    4.22.0
    PS D:\ThePlatform\View.WebInterface> webpack
    C:\Users\user\AppData\Roaming\npm\node_modules\webpack-cli\bin\config-yargs.js:89
                                    describe: optionsSchema.definitions.output.properties.path.description,
                                                                               ^

    TypeError: Cannot read property 'properties' of undefined
        at module.exports (C:\Users\Nikita\AppData\Roaming\npm\node_modules\webpack-cli\bin\config-yargs.js:89:48)
        at C:\Users\Nikita\AppData\Roaming\npm\node_modules\webpack-cli\bin\webpack.js:60:27
        at Object.<anonymous> (C:\Users\Nikita\AppData\Roaming\npm\node_modules\webpack-cli\bin\webpack.js:515:3)
        at Module._compile (module.js:652:30)
        at Object.Module._extensions..js (module.js:663:10)
        at Module.load (module.js:565:32)
        at tryModuleLoad (module.js:505:12)
        at Function.Module._load (module.js:497:3)
        at Module.require (module.js:596:17)
        at require (internal/module.js:11:18)

part of package.json

    "webpack": "4.20.2",
    "webpack-cli": "3.1.2",

A part of file webpack.config.js

module.exports = {
    entry: ['./App/System/app.ts', './App/System/scss/' + account + '.scss'],
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'App/Dist'),
    },
    resolve: {
        modules: [
            process.env.NODE_PATH || 'node_modules',
        ],
        extensions: ['.ts', '.js', '.html']
    },
    module: {
        rules: [
            {
                test: /\.ts$/,
                loaders: [
                    {
                        loader: 'awesome-typescript-loader',
                        options: { configFileName: path.resolve(__dirname, 'tsconfig.json') }
                    }, 'angular2-template-loader'
                ]
            },
            {
                test: /\.html$/,
                loader: 'html-loader'
            },
            {
                enforce: 'pre',
                test: /\.ts$/,
                use: "source-map-loader"
            },
            {
                test: /\.s?[ac]ss$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'sass-loader',
                ],
            },
        //    { test: /\.css$/, loader: 'style-loader!css-loader' },
        ]
    },
}

This problem appear when i updated webpack from version 4.8.3 to 4.20.2

Upvotes: 1

Views: 300

Answers (1)

user6299088
user6299088

Reputation:

npm install webpack installs it in the local directory. Usually you don't have that in your PATH so you're most likely executing webpack that was installed globally with npm install -g.

Try upgrading the globally installed webpack with:

npm upgrade -g webpack

Alternatively you can use the locally installed webpack with:

`npm bin`/webpack --version

Or:

PATH=`npm bin`:$PATH webpack --version

Upvotes: 1

Related Questions