R
R
Radiss2019-08-11 19:09:33
Node.js
Radiss, 2019-08-11 19:09:33

Why won't webpack dev-server start?

Globally installed [email protected] and [email protected]
VUE-CLI installed before npm run dev
package.json

spoiler

{
  "name": "vue-project",
  "description": "A Vue.js project",
  "version": "1.0.0",
  "author": "Marlin05 <[email protected]>",
  "license": "MIT",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
    "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
  },
  "dependencies": {
    "vue": "^2.5.11"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-env": "^1.6.0",
    "babel-preset-stage-3": "^6.24.1",
    "cross-env": "^5.0.5",
    "css-loader": "^0.28.7",
    "file-loader": "^1.1.4",
    "vue-loader": "^13.0.5",
    "vue-template-compiler": "^2.4.4",
    "webpack": "^3.6.0",
    "webpack-dev-server": "^2.9.1"
  }
}


main.js
spoiler

import Vue from 'vue'
import App from './App.vue'

new Vue({
  el: '#app',
  render: h => h(App)
})


webpack.config
spoiler
spoiler

var path = require('path')
var webpack = require('webpack')

module.exports = {
  entry: './src/main.js',
  output: {
    path: path.resolve(__dirname, './dist'),
    publicPath: '/dist/',
    filename: 'build.js'
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          'vue-style-loader',
          'css-loader'
        ],
      },      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
          }
          // other vue-loader options go here
        }
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        loader: 'file-loader',
        options: {
          name: '[name].[ext]?[hash]'
        }
      }
    ]
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js'
    },
    extensions: ['*', '.js', '.vue', '.json']
  },
  devServer: {
    historyApiFallback: true,
    noInfo: true,
    overlay: true
  },
  performance: {
    hints: false
  },
  devtool: '#eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
  module.exports.devtool = '#source-map'
  // http://vue-loader.vuejs.org/en/workflow/production.html
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      compress: {
        warnings: false
      }
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  ])
}


when running the commandпри запуске команды npm run dev error
spoiler

> [email protected]1.0.0 dev D:\ASITES\vuerjs\vue-project
> cross-env NODE_ENV=development webpack-dev-server --open --hot

"node" ▒▒ ▒▒▒▒ ▒▒▒▒७▒▒▒ ▒▒▒ ▒▒▒譥▒
▒▒▒▒▒▒▒▒, ▒ᯮ▒▒塞▒▒ ▒ணࠬ▒▒▒ ▒▒▒ ▒▒▒▒▒▒ 䠩▒▒▒.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected]1.0.0 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:\Users\user\AppData\Roaming\npm-cache\_logs\2019-08-11T15_47_47_839Z-debug.log


logs
spoiler

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\programms\\NODEjs\\node.exe',
1 verbose cli   'D:\\programms\\NODEjs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using [email protected]6.9.0
3 info using [email protected].16.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]1.0.0~predev: [email protected]1.0.0
6 info lifecycle [email protected]1.0.0~dev: [email protected]1.0.0
7 verbose lifecycle [email protected]1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]1.0.0~dev: PATH: D:\programms\NODEjs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\ASITES\vue\node_modules\.bin;C:\Users\user\bin;D:\programms\Git\mingw64\bin;D:\programms\Git\usr\local\bin;D:\programms\Git\usr\bin;D:\programms\Git\usr\bin;D:\programms\Git\mingw64\bin;D:\programms\Git\usr\bin;C:\Users\user\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;D:\Open Server\OpenServer\modules\Git\cmd;D:\Git\cmd;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Java\jdk1.8.0_131\bin;C:\Program Files\Java\jre1.8.0_131\bin;D:\programms;C:\WINDOWS\System32\OpenSSH;.;C:\Program Files\wget";D:\OpenServer\OSPanel\modules\php\PHP-7.2-x64;D:\programms\Git\cmd;D:\programms\NODEjs;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Roaming\Composer\vendor\bin;C:\Users\user\AppData\Local\GitHubDesktop\bin;C:\Users\user\AppData\Local\Microsoft\WindowsApps;D:\Open Server\OSPanel\modules\php\PHP-7.2-x64;C:\Users\user\AppData\Roaming\npm;D:\programms\Git\usr\bin\vendor_perl;D:\programms\Git\usr\bin\core_perl
9 verbose lifecycle [email protected]~dev: CWD: D:\ASITES\vue
10 silly lifecycle [email protected]~dev: Args: [ '/d /s /c',
10 silly lifecycle   'cross-env NODE_ENV=development webpack-dev-server --open --hot' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1  signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (D:\programms\NODEjs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (D:\programms\NODEjs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd D:\ASITES\vue
16 verbose Windows_NT 10.0.17134
17 verbose argv "D:\\programms\\NODEjs\\node.exe" "D:\\programms\\NODEjs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v10.16.0
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question