Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog Plugin broken #1371

Closed
1 task done
tedmiston opened this issue Feb 28, 2019 · 9 comments
Closed
1 task done

Blog Plugin broken #1371

tedmiston opened this issue Feb 28, 2019 · 9 comments
Labels
has PR Has a related PR topic: plugins Relates to VuePress plugins

Comments

@tedmiston
Copy link
Contributor

tedmiston commented Feb 28, 2019

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

Bug report

I'm experiencing an issue on alpha.40 where the blog plugin causes VuePress to crash on startup.

Both disabling the blog plugin in the config and/or downgrading VuePress and the plugin to alpha.37 seem to work sucessfully, however, I cannot get the blog plugin to work on versions > v1.0.0-alpha.37.

Edit: I misspoke — downgrading does not seem to resolve the error, only disabling the plugin entirely.

Please let me know if you have any ideas how to resolve or if I have missed something in the setup.

Version

Versions:

$ yarn run vuepress --version
yarn run v1.13.0
warning package.json: No license field
$ /Users/taylor/vuepress-blog-test/node_modules/.bin/vuepress --version
vuepress/1.0.0-alpha.40 darwin-x64 node-v11.9.0
✨  Done in 0.52s.
$ yarn --version
1.13.0
$ npm --version
6.7.0
$ node --version
v11.9.0

Steps to reproduce

Steps to reproduce:

mkdir vuepress-blog-test
cd vuepress-blog-test
yarn add vuepress@next
yarn add -D @vuepress/plugin-blog@next

I followed the directions at https://v1.vuepress.vuejs.org/plugin/official/plugin-blog.html to configure the blog plugin.

Config:

$ cat .vuepress/config.js
module.exports = {
  title: 'Foo',
  plugins: [
    '@vuepress/blog'
  ]
}

What is expected?

I expect VuePress to start normally including the Blog Plugin.

What is actually happening?

VuePress crashes on startup.

Trying to run dev mode:

$ yarn run vuepress dev
yarn run v1.13.0
warning package.json: No license field
$ /Users/taylor/vuepress-blog-test/node_modules/.bin/vuepress dev
wait Extracting site metadata...
tip Apply theme @vuepress/theme-default
warning Cannot read property 'Categories' of undefined
TypeError: Cannot read property 'multiple' of undefined
    at PluginAPI.use (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/plugin-api/index.js:94:16)
    at pluginsConfig.forEach (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/plugin-api/index.js:139:12)
    at Array.forEach (<anonymous>)
    at PluginAPI.useByPluginsConfig (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/plugin-api/index.js:138:19)
    at PluginAPI.use (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/plugin-api/index.js:105:12)
    at AppContext.applyUserPlugins (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/prepare/AppContext.js:176:8)
    at AppContext.process (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/prepare/AppContext.js:102:10)
    at prepare (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/prepare/index.js:17:20)
    at prepareServer (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/dev.js:28:32)
    at module.exports (/Users/taylor/vuepress-blog-test/node_modules/@vuepress/core/lib/dev.js:4:40)
    at args (/Users/taylor/vuepress-blog-test/node_modules/vuepress/lib/util.js:35:12)
    at CAC.cli.command.option.option.option.option.option.option.option.option.action (/Users/taylor/vuepress-blog-test/node_modules/vuepress/lib/registerCoreCommands.js:34:23)
    at CAC.runMatchedCommand (/Users/taylor/vuepress-blog-test/node_modules/cac/dist/index.js:787:38)
    at CAC.parse (/Users/taylor/vuepress-blog-test/node_modules/cac/dist/index.js:707:18)
    at CLI (/Users/taylor/vuepress-blog-test/node_modules/vuepress/lib/util.js:23:7)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Other relevant information

  • Your OS: macOS High Sierra
  • Node.js version: v11.9.0
  • Browser version: n/a
  • Is this a global or local install? local
  • Which package manager did you use for the install? Yarn
  • Does this issue occur when all plugins are disabled? No (the bug seems to be with the plugin)
@tedmiston tedmiston changed the title Blog Plugin broken in > v1.0.0-alpha.37 Blog Plugin broken Feb 28, 2019
@shigma shigma added the topic: plugins Relates to VuePress plugins label Feb 28, 2019
@stickmy
Copy link
Contributor

stickmy commented Mar 1, 2019

Caused by the new themeAPI.
https://github.com/vuejs/vuepress/blob/d16d3d574e/packages/%40vuepress/plugin-blog/index.js#L4
The layoutComponentMap is undefined.

@tedmiston
Copy link
Contributor Author

@Bloss Thank you. I'm not too familiar with the Plugin or Theme APIs yet. Do you have any idea what should be changed to work with the new Theme API?

@meteorlxy
Copy link
Member

Edit: I misspoke — downgrading does not seem to resolve the error, only disabling the plugin entirely.

@tedmiston There might be some peoblems to downgrade vuepress by yarn #1379

@Qymh
Copy link

Qymh commented Mar 2, 2019

there is a way to resolve the problem quickly but not completely solve the problem. To change node_modules/@vuepress/core/lib/plugin-api/index.js.Change the 84 line from let plugin to let plugin = {}

@shigma
Copy link
Collaborator

shigma commented Mar 2, 2019

Actually there are two problems:

  • vuepress-plugin-blog is not yet complete
  • plugin-api may break when some plugin has error

The second problem can be fixed by #1383.

@shigma shigma added the has PR Has a related PR label Mar 2, 2019
@tedmiston
Copy link
Contributor Author

Okay, so a fix to the second problem has been resolved, merged, and release.

Any idea what is left to do for vuepress-plugin-blog to be complete, at least in the sense of being able to see pages that list posts, tags, categories, etc?

@songololo
Copy link

The roadmap has some info, looks like it'll be getting some dev time over the next month:
https://github.com/vuejs/vuepress/projects/1

@Frank-
Copy link

Frank- commented Mar 6, 2019

If this is useful to anyone running in to this issue. I fixed this problem for now by changing Line 4 in node_modules/@vuepress/plugin-blog/index.js from const { layoutComponentMap } = ctx to const { layoutComponentMap } = ctx.themeAPI.

@ulivz
Copy link
Member

ulivz commented Jun 4, 2019

See: #36 (comment)

@ulivz ulivz closed this as completed Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR Has a related PR topic: plugins Relates to VuePress plugins
Projects
None yet
Development

No branches or pull requests

8 participants