vuejs/vuepress

fresh new 1.x project fails to build (but dev works OK)

jorismak opened this issue · 2 comments

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

mkdir my-new-project
cd my-new-project
npx create-vuepress-site
npm run dev
npm run build

What is expected?

Successful build when a project is just scaffolded.

What is actually happening?

$ npm run build

> vuepress-test@0.0.1 build
> vuepress build src

wait Extracting site metadata...
tip Apply theme @vuepress/theme-default ...
warning An error was encountered in plugin "@vuepress/plugin-back-to-top"
warning An error was encountered in plugin "@vuepress/plugin-medium-zoom"
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...

✖ Client
  Compiled with some errors in 7.44s

✔ Server
  Compiled successfully in 5.74s

(undefined) ./node_modules/@vuepress/core/.temp/style.styl
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:795:74)
    at __webpack_require__ (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:21:30)
    at Object.<anonymous> (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:394:1)
    at __webpack_require__ (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:21:30)
    at Object.<anonymous> (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:740:28)
    at __webpack_require__ (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:21:30)
    at /home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:85:18
    at Object.<anonymous> (/home/joris/vhosts/vuepress-test/docs/node_modules/css-loader/dist/cjs.js??ref--13-oneOf-1-1!/home/joris/vhosts/vuepress-test/docs/node_modules/postcss-loader/src/index.js??ref--13-oneOf-1-2!/home/joris/vhosts/vuepress-test/docs/node_modules/stylus-loader/index.js??ref--13-oneOf-1-3!/home/joris/vhosts/vuepress-test/docs/node_modules/@vuepress/core/.temp/style.styl:88:10)

and this goes on for quite a bit, with lots of repeated blocks of errors.

Other relevant information

  • Output of npx vuepress info in my VuePress project:
  System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H
  Binaries:
    Node: 14.19.3 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.12.2 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vuepress/core:  1.9.7 
    @vuepress/theme-default:  1.9.7 
    vuepress: ^1.5.3 => 1.9.7 
  npmGlobalPackages:
    vuepress: Not Found

(from inside the generated docs directory)

The same thing happens when I try it with yarn btw.

Is probably related / the same as #3061

@jorismak

I also got the similar error.
But in my case error only occurred in GitHub Actions.

I applied patch to call console.log() to exec() of node_modules/mini-css-extract-plugin/dist/loader.js to get code line which error reported.

'Cannot read property 'prototype' of undefined' caused in below code:

var DOM_EXCEPTION = 'DOMException';
var Error = getBuiltIn('Error');
var NativeDOMException = getBuiltIn(DOM_EXCEPTION);

var $DOMException = function DOMException() {
  ...
};

var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype; // <--- Here

This is the code of core-js.

I have 2 projects:

  • project1 (GitHub Actions: success)
  • project2 (Github Actions: failure)

I compared installed packages.

npm ls -t core-js
<project1>
└─┬ vuepress@1.9.7
  └─┬ @vuepress/core@1.9.7
    ├─┬ @vue/babel-preset-app@4.5.15
    │ └── core-js@3.20.3 deduped
    └── core-js@3.20.3
npm ls -t core-js
<project2>
└─┬ vuepress@1.9.7
  └─┬ @vuepress/core@1.9.7
    ├─┬ @vue/babel-preset-app@4.5.19
    │ └── core-js@3.25.3 deduped
    └── core-js@3.25.3

I noticed the difference of version of @vue/babel-preset-app, and I tried deployments by fixing installed version like below:

{
  "devDependencies": {
    "@vue/babel-preset-app": "4.5.18"
  }
}

Results were

@vue/babel-preset-app build
4.5.19 Error
4.5.18 OK
4.5.17 OK
4.5.16 OK
4.5.15 OK

You may avoid the build error by fixing version of @vue/babel-preset-app.

4.5.19 was released on 2022/06/28, a few days before you reported this issue.

https://github.com/vuejs/vue-cli/releases/tag/v4.5.19
vuejs/vue-cli@c7fa1cf

Note that I don't understand why this is the problem.

@smori1983 thx!use 4.5.18 solved the problem,I have this problem because I am using windows.atob, which is a little strange.