Ошибка при запуске webpack-dev-server

Stack Overflow на русском Asked by Voprositel on October 31, 2020

Только начал изучать webpack. При попытке запустить webpack-dev-server выдает ошибку:

‘webpack-dev-server’ is not recognized as an internal or external command,
operable program or batch file.

И далее:

npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev 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!     C:UsersUSERAppDataRoamingnpm-cache_logs2020-10-08T20_01_35_206Z-debug.log

Вот package.json:

    "name": "my",
    "version": "1.0.0",
    "description": "",
    "main": "app.js",
    "scripts": {
        "dev": "webpack-dev-server",
        "build": "webpack"
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "webpack": "^4.44.2",
        "webpack-cli": "^3.3.12"

И webpack.config.js:

const path = require('path');

module.exports = {
    entry: {
        app: './js/app.js'
    context: path.resolve(__dirname, 'src'),
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    devServer: {
        publicPath: '/',
        port: 9000,
        contentBase: path.join(process.cwd(), 'dist'),
        host: 'localhost',
        historyApiFallback: true,
        noInfo: false,
        stats: 'minimal',
        hot: true,
    mode: 'development'

Как решить данную проблему?

One Answer

Установите модуль для начала.

npm install webpack-dev-server --save-dev

И дальше по инструкции тут

Correct answer by Aziz Umarov on October 31, 2020

Add your own answers!

Related Questions

Cервисы для удаленной разработке на macOS

0  Asked on December 10, 2020 by oleg-stepanov


Группировка RecyclerView Android

1  Asked on December 10, 2020 by grand


Cookie и private api instagram

1  Asked on December 10, 2020 by brainswitch


Отправить ajax и получить ответ

1  Asked on December 7, 2020 by js-student


Закрасить половину окна java swing

1  Asked on December 7, 2020 by playrus


Подмена цвета PNG при наведении мыши

3  Asked on December 6, 2020 by vadim-rudenko


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP