Skip to content

@vue/component-compiler-utils should be dependency of @vuepress/shared-utils #2091

Open
@fangbinwei

Description

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

Bug report

Steps to reproduce

github repo

git clone https://github.com/fangbinwei/vuepress-dep-issue.git

cd vuepress-dep-issue

// use master branch or git checkout simple-demo     
yarn install --production

yarn run build

error:

$ vuepress build
internal/modules/cjs/loader.js:800
    throw err;
    ^

Error: Cannot find module '@vue/component-compiler-utils'
Require stack:
- /private/tmp/vuepress-dep-issue/node_modules/@vuepress/shared-utils/lib/parseVueFrontmatter.js
- /private/tmp/vuepress-dep-issue/node_modules/@vuepress/shared-utils/lib/index.js
- /private/tmp/vuepress-dep-issue/node_modules/vuepress/lib/checkEnv.js
- /private/tmp/vuepress-dep-issue/node_modules/vuepress/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/private/tmp/vuepress-dep-issue/node_modules/@vuepress/shared-utils/lib/parseVueFrontmatter.js:7:36)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/private/tmp/vuepress-dep-issue/node_modules/@vuepress/shared-utils/lib/parseVueFrontmatter.js',
    '/private/tmp/vuepress-dep-issue/node_modules/@vuepress/shared-utils/lib/index.js',
    '/private/tmp/vuepress-dep-issue/node_modules/vuepress/lib/checkEnv.js',
    '/private/tmp/vuepress-dep-issue/node_modules/vuepress/cli.js'
  ]
}
error Command failed with exit code 1.

What is expected?

vuepress build successfully

What is actually happening?

Affected by devDependencies of my repo, @vuepress#core#vue-loader#@vue/component-compiler-utils won't be hoisted. so parseVueFrontmatter.js can't load module correctly.

I think @vue/component-compiler-utils should be specified in package.json of @vuepress/shared-utils

Other relevant information

I maintain a mono-repo for vue-cli-plugins, @vue/cli-service(for unit test) is devDep of my root package, and vuepress is dep (for plugins docs). This problem happened after I update some dependencies.

yarn install --production && yarn run build are executed in CI to build doc. Consider that some devDeps in my repo is hard to install in China (puppeteer), so I use yarn install --production in CI.

  • Output of npx vuepress info in my VuePress project:
Environment Info:

  System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 12.14.0 - ~/.nvm/versions/node/v12.14.0/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.14.0/bin/npm
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: Not Found
    Safari: 13.0.3
  npmPackages:
    @vuepress/core:  1.2.0 
    @vuepress/theme-default:  1.2.0 
    vuepress: ^1.2.0 => 1.2.0 
  npmGlobalPackages:
    vuepress: Not Found

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: pluginsRelates to VuePress pluginstype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions