zoukankan      html  css  js  c++  java
  • 转载:TypeError: Cannot read property 'compilation' of undefined vue 打包运行npm run build 报错

    转载自:https://www.jianshu.com/p/3f8f60e01797

    运行npm run build打包时,报错如下:

     

    我的package.json如下:

     1 {
     2   ...
     3   "devDependencies": {
     4     "autoprefixer": "^7.1.2",
     5     "babel-core": "^6.22.1",
     6     "babel-eslint": "^8.2.1",
     7     "babel-helper-vue-jsx-merge-props": "^2.0.3",
     8     "babel-loader": "^7.1.1",
     9     "babel-plugin-syntax-jsx": "^6.18.0",
    10     "babel-plugin-transform-runtime": "^6.22.0",
    11     "babel-plugin-transform-vue-jsx": "^3.5.0",
    12     "babel-preset-env": "^1.3.2",
    13     "babel-preset-stage-2": "^6.22.0",
    14     "babel-register": "^6.22.0",
    15     "chalk": "^2.0.1",
    16     "chromedriver": "^2.27.2",
    17     "copy-webpack-plugin": "^4.0.1",
    18     "cross-spawn": "^5.0.1",
    19     "css-loader": "^2.1.1",
    20     "element-theme-chalk": "^2.8.2",
    21     "element-ui": "^2.8.2",
    22     "eslint": "^4.15.0",
    23     "eslint-config-standard": "^10.2.1",
    24     "eslint-friendly-formatter": "^3.0.0",
    25     "eslint-loader": "^1.7.1",
    26     "eslint-plugin-import": "^2.7.0",
    27     "eslint-plugin-node": "^5.2.0",
    28     "eslint-plugin-promise": "^3.4.0",
    29     "eslint-plugin-standard": "^3.0.1",
    30     "eslint-plugin-vue": "^4.0.0",
    31     "extract-text-webpack-plugin": "^3.0.0",
    32     "file-loader": "^1.1.11",
    33     "friendly-errors-webpack-plugin": "^1.6.1",
    34     "html-webpack-plugin": "^2.30.1",
    35     "nightwatch": "^1.1.11",
    36     "node-notifier": "^5.1.2",
    37     "node-sass": "^4.12.0",
    38     "optimize-css-assets-webpack-plugin": "^5.0.1",
    39     "ora": "^1.2.0",
    40     "portfinder": "^1.0.13",
    41     "postcss-import": "^11.0.0",
    42     "postcss-loader": "^2.0.8",
    43     "postcss-url": "^7.2.1",
    44     "rimraf": "^2.6.0",
    45     "rxjs": "^6.5.2",
    46     "rxjs-compat": "^6.5.2",
    47     "sass-loader": "^7.1.0",
    48     "selenium-server": "^3.0.1",
    49     "semver": "^5.3.0",
    50     "shelljs": "^0.7.6",
    51     "style-loader": "^0.23.1",
    52     "ts-loader": "^3.5.0",
    53     "typescript": "^3.4.5",
    54     "uglifyjs-webpack-plugin": "^1.1.1",
    55     "url-loader": "^1.1.2",
    56     "vue-class-component": "^7.1.0",
    57     "vue-i18n": "^8.11.2",
    58     "vue-i18n-extract": "^0.4.14",
    59     "vue-loader": "^13.3.0",
    60     "vue-property-decorator": "^8.1.1",
    61     "vue-rx": "^6.2.0",
    62     "vue-style-loader": "^3.0.1",
    63     "vue-template-compiler": "^2.5.2",
    64     "vuex": "^3.1.1",
    65     "webpack": "^3.6.0",
    66     "webpack-bundle-analyzer": "^3.3.2",
    67     "webpack-dev-server": "^2.9.1",
    68     "webpack-merge": "^4.1.0"
    69   },
    70   "engines": {
    71     "node": ">= 6.0.0",
    72     "npm": ">= 3.0.0"
    73   },
    74   "browserslist": [
    75     "> 1%",
    76     "last 2 versions",
    77     "not ie <= 8"
    78   ]
    79 }
    View Code
    后来查资料发现是版本问题,webpack是3.6.0的版本,但是optimize-css-assets-webpack-plugin是5.0.1的版本。后来把optimize-css-assets-webpack-plugin改为3.2.0的就可以了。
    执行 npm i optimize-css-assets-webpack-plugin@3.2.0就可以改为3.2.0的版本了。
    注:如果执行 npm i optimize-css-assets-webpack-plugin@3.2.0完成后出现如下提示,不要按提示执行,会把optimize-css-assets-webpack-plugin恢复到原来的版本,直接忽略提示就好了。

    转载自:https://www.jianshu.com/p/3f8f60e01797

  • 相关阅读:
    C++实例 分解质因数
    C++语言 堆排序
    下载吧压缩工具(360超级注释压缩)
    unresolved external symbol __endthreadex错误解决
    C语言 常用函数A
    C++实例 获取进程所在文件夹
    IIS 服务或万维网发布服务,或者依赖这 服务可能在启动期间发生错误或者已禁用
    字體的css
    ubuntu下mono初体验<一>
    NOSQL之mongodb简介及安装 for linux(centOS)<二>
  • 原文地址:https://www.cnblogs.com/mySummer/p/11198755.html
Copyright © 2011-2022 走看看