一般情况是因为Webpack与webpack-dev-server版本不兼容导致。

package.json

{
  "name": "vue-loader-demo",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "dev": "webpack-dev-server --inline --hot  --port 8082"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@babel/core": "^7.4.4",
    "build": "^0.1.4",
    "vue": "^1.0.28"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^6.4.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-runtime": "^6.26.0",
    "css-loader": "^0.25.0",
    "vue-hot-reload-api": "^1.3.2",
    "vue-html-loader": "^1.2.4",
    "vue-loader": "^8.5.4",
    "vue-style-loader": "^1.0.0",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.15.0"
  }

可以直接粘贴进去,如果还有错 npm install下

再npm run dev

 

 

一般情况是因为Webpack与webpack-dev-server版本不兼容导致。

像我也出现此问题,我电脑的webpack是1.13.1,但webpack-dev-server是2.x以上的版本。
当我将webpack-dev-server卸载掉:npm uninstall webpack-dev-server -g
然后安装1.15.0版本的webpack-dev-server,就可解决了此问题。:npm install webpack-dev-server@1.15.0 -g

转载于:https://www.cnblogs.com/liubingyjui/p/10858609.html

Logo

前往低代码交流专区

更多推荐