vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.42k stars 4.78k forks source link

vuepress build failed #2877

Open wangdaodao opened 3 years ago

wangdaodao commented 3 years ago

Bug report

Steps to reproduce

vuepress build docs
TypeError: node.getIterator is not a function
    at LazyResult.visitTick (/github/workspace/node_modules/postcss/lib/lazy-result.js:528:33)
    at LazyResult.runAsync (/github/workspace/node_modules/postcss/lib/lazy-result.js:408:30)
    at LazyResult.async (/github/workspace/node_modules/postcss/lib/lazy-result.js:221:30)
    at LazyResult.then (/github/workspace/node_modules/postcss/lib/lazy-result.js:206:17)
    at OptimizeCssAssetsWebpackPlugin.processCss (/github/workspace/node_modules/optimize-css-assets-webpack-plugin/src/index.js:81:8)
    at Object.processor (/github/workspace/node_modules/optimize-css-assets-webpack-plugin/src/index.js:20:18)
    at /github/workspace/node_modules/last-call-webpack-plugin/src/index.js:150:10
    at arrayEach (/github/workspace/node_modules/lodash/_arrayEach.js:15:9)
    at forEach (/github/workspace/node_modules/lodash/forEach.js:38:10)
    at OptimizeCssAssetsWebpackPlugin.process (/github/workspace/node_modules/last-call-webpack-plugin/src/index.js:147:5)
    at /github/workspace/node_modules/last-call-webpack-plugin/src/index.js:178:28
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/github/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:17)
    at AsyncSeriesHook.lazyCompileHook (/github/workspace/node_modules/tapable/lib/Hook.js:154:20)
    at /github/workspace/node_modules/webpack/lib/Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/github/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/github/workspace/node_modules/tapable/lib/Hook.js:154:20)
* Client █████████████████████████ chunk asset optimization (92%) OptimizeCssAssetsWebpackPlugin

I think OptimizeCssAssetsWebpackPlugin is error!

What is expected?

build passed

What is actually happening?

build failed

Other relevant information

Environment Info:

  System:
    OS: Windows 10 10.0.19042
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
  Binaries:
    Node: 14.15.1 - ~\AppData\Local\Temp\yarn--1624436197097-0.03625811294774661\node.CMD
    Yarn: 1.22.10 - ~\AppData\Local\Temp\yarn--1624436197097-0.03625811294774661\yarn.CMD
    npm: 6.14.8 - D:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 91.0.4472.114
    Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.54)
  npmPackages:
    @vuepress/core:  1.8.2 
    @vuepress/theme-default:  1.8.2 
    vuepress: ^1.5.4 => 1.8.2 
  npmGlobalPackages:
    vuepress: Not Found

Done in 3.54s.
elct9620 commented 3 years ago

The error seems caused by postcss@8, the optimize-css-assets-webpack-plugin is dependent on postcss@8 but I am unable to downgrade it.

└─┬ vuepress@1.8.2
  └─┬ @vuepress/core@1.8.2
    ├─┬ autoprefixer@9.8.6
    │ └── postcss@7.0.36
    ├─┬ css-loader@2.1.1
    │ ├─┬ icss-utils@4.1.1
    │ │ └── postcss@7.0.36
    │ ├── postcss@7.0.36
    │ ├─┬ postcss-modules-extract-imports@2.0.0
    │ │ └── postcss@7.0.36
    │ ├─┬ postcss-modules-local-by-default@2.0.6
    │ │ └── postcss@7.0.36
    │ ├─┬ postcss-modules-scope@2.2.0
    │ │ └── postcss@7.0.36
    │ └─┬ postcss-modules-values@2.0.0
    │   └── postcss@7.0.36
    ├─┬ optimize-css-assets-webpack-plugin@5.0.7
    │ └── postcss@8.3.5
    ├─┬ postcss-loader@3.0.0
    │ └── postcss@7.0.36
    ├─┬ postcss-safe-parser@4.0.2
    │ └── postcss@7.0.36
    └─┬ vue-loader@15.9.7
      └─┬ @vue/component-compiler-utils@3.2.2
        └── postcss@7.0.36
elct9620 commented 3 years ago

My workaround is to add selective dependency resolutions into package.json and it can build correctly.

  "resolutions": {
    "optimize-css-assets-webpack-plugin": "5.0.6"
  }

I think this is the same issue with #2875

marcinjahn commented 3 years ago

Because of this issue the Getting Started guide fails for everyone:

npx create-vuepress-site
cd docs
npm install
npm run build

Error is the same as in the first topic.

wangdaodao commented 3 years ago

My workaround is to add selective dependency resolutions into package.json and it can build correctly.

  "resolutions": {
    "optimize-css-assets-webpack-plugin": "5.0.6"
  }

I think this is the same issue with #2875

Nice, it's work, thanks !