zoukankan      html  css  js  c++  java
  • 当使用npm run build的时候报错:TypeError: Cannot read property 'thisCompilation' of undefined

    最近接手公司前端外包出去的的项目,然后在npm run build的时候遇到了两个问题。

    第一点是  A complete log of this run can be found in:
    npm ERR!     C:Users90422AppDataRoaming pm-cache\_logs2018-04-28T09_26_42_435Z-debug.log

    这个问题很简单,主要是npm自己报错了,更新npm 即可。(奇怪的只是这个项目需要这样,其他项目并没有这个问题,所以还需要查查原因)

    命令为:npm i -g npm to update


    第二点是更新完npm之后再次运行npm run build 发现还有报错,错误如下:

    node_modulesextract-text-webpack-plugindistindex.js:183
        compiler.hooks.thisCompilation.tap(plugin, compilation => {
                       ^

    TypeError: Cannot read property 'thisCompilation' of undefined

    at ExtractTextPlugin.apply (D:OA ode_modulesextract-text-webpack-plugindistindex.js:183:20)

    网上百度了一下并没有解决方案,只有大部分报错叫更新一下extract-text-webpack-plugin

    然后我看了一下给到我手的package.json发现版本是@4.0.0-beta,但大概可以猜到可能就是这个问题了,就动手解决

    先卸载执行 npm uninstall --save-dev extract-text-webpack-plugin

    再安装 npm install --save-dev extract-text-webpack-plugin

    一定要记得先卸载再安装,不然装不上的哦!

    之前开发并没有接触多少webpack搭建的项目,所以卡住了。希望跟我遇到一样问题的不用像我一样被卡住那么久。

    本文转自:https://www.cnblogs.com/liuxinheng/articles/10125413.html?from=singlemessage

  • 相关阅读:
    Count and Say
    Valid Sudoku
    Find First and Last Position of Element in Sorted Array
    Search in Rotated Sorted Array
    Longest Valid Parentheses
    web前端中文教程库
    三代基因组拼接软件--Falcon篇
    使用ThreadPoolExecutor并行执行独立的单线程任务
    python中的计时器:timeit
    Python教程
  • 原文地址:https://www.cnblogs.com/nizuimeiabc1/p/12153154.html
Copyright © 2011-2022 走看看