FriendlyUser / vuepress-theme-cool

A custom vuepress theme with mermaid and plantuml, katex and vue components.
https://vuepress-theme-cool.js.org/
MIT License
59 stars 11 forks source link

error when working with VuePress 1.7.1 #21

Closed rbhuang closed 1 year ago

rbhuang commented 3 years ago

Loading app.js through exception

FriendlyUser commented 3 years ago

Do you have vuepress installed globally?

I had some problems running vuepress-theme-cool with 1.7.1 with it installed globally, was planning to look into it for vuepress@2.0.0

Keep in mind the vuepress plugins installed in vuepress-theme-cool-starter should also be versioned. Took me a long time to realise this.

  "dependencies": {
    "@vuepress/plugin-back-to-top": "^1.7.1",
    "@vuepress/plugin-pwa": "^1.7.1",
    "vuepress": "^1.7.1",
    "vuepress-theme-cool": "^1.3.1"
  },
rbhuang commented 3 years ago

no. I install both VuePress 1.7.1 and VuePress-theme-cool locally.

FriendlyUser commented 3 years ago

image

From https://travis-ci.org/github/FriendlyUser/vuepress-theme-cool-starter/jobs/752910733

$ node --version
v14.15.4
$ npm --version
6.14.10
$ nvm --version
0.37.2
$ yarn --version
1.22.4

Building on node 14 and 15 works for CI, dont know your use case right now.

Could be that either the latest versions of vuepress expect newer versions of node or my my theme only works for later versions of node (I haven't really released a new version in a while).

rbhuang commented 3 years ago

My node version is 12.16.3. Not sure is it the cause of the problem. In order to reproduce my issue, you can create a new folder and run yarn add vuepress and vuepress-theme-cool. The package .json would be: { "devDependencies": { "vuepress": "^1.7.1", "vuepress-theme-cool": "^1.3.1" }, "scripts": { "docs:dev": "vuepress dev docs", "docs:build": "vuepress build docs" } } I create .vuepress/config.js as module.exports = { theme: 'cool', markdown: { extendMarkdown: md => { md.set({ html: true }) md.use(require('markdown-it-katex')) md.use(require('markdown-it-plantuml')) md.use(require('markdown-it-admonition')) } } }

Then create README.MD with one line of '# hello'

start the dev env and localhost:8080 show nothing. image

FriendlyUser commented 3 years ago

It might be related to my outdated dependencies, it is possibly I need to add

plugin-register-components and only have global components within .vuepress instead of a mix of components in the theme and in the starter example.

FriendlyUser commented 3 years ago

I will try some things, but no guarantees, if you cloned vuepress-theme-cool-starter it might be the Styles.vue file is the same in both themes.

I will try some things out, no idea why it works in node 14 and 15, but not 12.