Vuepress: Error in build (postcss_1.default is not a function)

Created on 26 Apr 2018  路  17Comments  路  Source: vuejs/vuepress

This error appeared after I cleared my modules directory and reinstalled from scratch (no package-lock.json). I cleared npm cache, and tested on a completely blank project with only a single readme.md file with no configuration changes and it fails in the exact same way.

OS: Window 10
Node: 9.5.0
VuePress: 0.8.4
Local install (npm)

Error message:

ERROR in ./site/.vuepress/theme/Page.vue?vue&type=style&index=0&lang=stylus (./node_modules/css-loader??ref--11-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/lib??ref--11-oneOf-1-2!./node_modules/stylus-loader??ref--15-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./site/.vuepress/theme/Page.vue?vue&type=style&index=0&lang=stylus)
Module build failed: TypeError: postcss_1.default is not a function
    at compileStyle (D:\Development\Keiser\Keiser.Web\Keiser.Web.Dev\node_modules\@vue\component-compiler-utils\dist\compileStyle.js:34:35)
    at Object.module.exports (D:\Development\Keiser\Keiser.Web\Keiser.Web.Dev\node_modules\vue-loader\lib\loaders\stylePostLoader.js:9:33)
bug

Most helpful comment

Fixed in @vue/[email protected]

All 17 comments

I just tested on a second computer (also Windows 10, Node 9.5.0) and it shows the same error with a new project.

Have you tried with yarn?

I just tried with yarn version 1.6.0 and have the same error.

same error

Maybe I need to borrow a windows to repro that. 馃槄

Tried it with several versions of VuePress, clean install each time. Same error.

Module build failed: TypeError: postcss_1.default is not a function
    at compileStyle (/mnt/c/CODE/vuepress/node_modules/@vue/component-compiler-utils/dist/compileStyle.js:34:35)
    at Object.module.exports (/mnt/c/CODE/vuepress/node_modules/vue-loader/lib/loaders/stylePostLoader.js:9:33)

OS: Windows 10 (Insider build 17134), using Ubuntu 16.04 via WSL
Node: 8.11.1
VuePress: 0.4.1, 0.6.1, 0.7.0, 0.8.4
Local install (yarn)

I just tested on a Linux box and have the same error.

Ubuntu 16.04.03
Node 10.0.0

This issue didn't exist yesterday when I performed a clean install, so it's most likely the result of a release from the last day or so.

But it seems like the previous version also can not work?

I have been able to get it working by modifying line 34 of the compileStyle.js file and removing the .default making the line result = postcss_1(plugins).process(source, postCSSOptions);.

I'm guessing the issue is somewhere in the build process for that library.

Reported an issue (https://github.com/vuejs/component-compiler-utils/issues/9) to @component-compilter-utils, please wait patiently.

@bayssmekanique Thanks. I temporarily solved this issue like what you did.

@dolare @bayssmekanique

Instead of messing up with compileStyle.js, add this to your package.json:

    "resolutions": {
        "@vue/component-compiler-utils": "1.1.0"
    }

This will use the previous version of @vue/component-compiler-utils and everything will work as expected!

image

Fixed in @vue/[email protected]

@filipekiss Thanks for letting me know that.

@dolare No problem! the resolutions attribute is great for when this happens or when you need to keep a dependency "flat" across all modules of an app

Was this page helpful?
0 / 5 - 0 ratings

Related issues

herrbischoff picture herrbischoff  路  3Comments

zeke picture zeke  路  3Comments

shaodahong picture shaodahong  路  3Comments

lesliecdubs picture lesliecdubs  路  3Comments

cfjedimaster picture cfjedimaster  路  3Comments