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

vuepress@next fails to resolve custom theme when run globally #1568

Closed
stasson opened this issue Apr 27, 2019 · 3 comments
Closed

vuepress@next fails to resolve custom theme when run globally #1568

stasson opened this issue Apr 27, 2019 · 3 comments

Comments

@stasson
Copy link

stasson commented Apr 27, 2019

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

Bug report

Version

1.0.0-alpha.47

Steps to reproduce

considering such config file

// .vuepress/config.js
module.exports = {
  theme: '@myscope/my-theme'
};

when installing vuepress globally and a custom theme locally

> npm i -g vuepress@next
> npm i  @myscope/vuepress-theme-my-theme

vuepress fail to resolve the custom theme

> vuepress dev .
Error: Cannot find module '@myscope/vuepress-theme-my-theme/package.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.resolve (internal/modules/cjs/helpers.js:32:19)
    at normalizeThemePath (C:\Users\az02080\AppData\Roaming\npm\node_modules\vuepress\node_modules\@vuepress\core\lib\node\loadTheme.js:59:33)

What is expected?

expecting custom theme to be resolved as in cwd.

What is actually happening?

custom theme is not resolved.

Other relevant information

  • Your OS: win10
  • Node.js version: node 10.15.0
  • Browser version: chrome 73
  • Is this a global or local install? global
  • Which package manager did you use for the install? npm
  • Does this issue occur when all plugins are disabled? no

if vuepress installed and run locally , everything is fine, so this is not a critical issue.
Still would be a nice fix: vuepress installed globally in docker while theme installed in repo allows to speed up our CI big time. also nice to have for dev env.

@stasson
Copy link
Author

stasson commented Apr 27, 2019

at loadTheme.js L59

const packageRoot = require.resolve(`${name}/package.json`)

probably would work if we had ?

const packageRoot = require.resolve(`${name}/package.json`, {paths: [process.cwd()] })

@stasson
Copy link
Author

stasson commented Apr 27, 2019

also probably same issue as #399 but for v1.x

@flozero
Copy link
Collaborator

flozero commented Sep 30, 2019

hello i am closing this issue as we are not using next. Please consider to not install vuepress globally but in project instead

@flozero flozero closed this as completed Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants