Vuepress: Cannot resolve plugin "@vuepress/plugin-google-analytics" / "@vuepress/google-analytics"

Created on 20 May 2019  路  7Comments  路  Source: vuejs/vuepress

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

Bug report

Steps to reproduce

Create brand new vuepress site and install @vuepress/google-analytics.

What is expected?

Google analytics code to be added to the output when building for production.

What is actually happening?

Warning is displayed during the build process

warning [vuepress] cannot resolve plugin "@vuepress/google-analytics"

Other relevant information

I also tried to change the config key to @vuepress/plugin-google-analytics as this is the name of the plugin in package.json but nothing changed.

My config.js file has the following code:

module.exports = {
    plugins: [
        ['@vuepress/plugin-google-analytics', {
            ga: 'UA-29469126-4'
        }]
    ]
};
  • [ ] My VuePress version is lower and euqal than 1.0.0-alpha.47:

    • VuePress version: [email protected]
    • OS: macOS Mojave 10.14.4
    • Node.js version: v8.15.0
    • Browser version: Chrome 74
    • Is this a global or local install? Global
    • Which package manager did you use for the install? Yarn
    • Does this issue occur when all plugins are disabled? Yes
  • [x] My VuePress version is higher than 1.0.0-alpha.47, the following is the output of vuepress info in my VuePress project:

Environment Info:

  System:
    OS: macOS 10.14.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 8.15.0 - /usr/local/opt/node@8/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/opt/node@8/bin/npm
  Browsers:
    Chrome: 74.0.3729.157
    Firefox: 64.0.2
    Safari: 12.1
  npmPackages:
    @vuepress/core: Not Found
    @vuepress/theme-default: Not Found
    vuepress: Not Found
  npmGlobalPackages:
    vuepress: Not Found

npx vuepress info actually resulted in the following error:

Usage: vuepress <command> [options]

Options:
  -V, --version                output the version number
  -h, --help                   output usage information

Commands:
  dev [options] [targetDir]    start development server
  build [options] [targetDir]  build dir as static site
  eject [targetDir]            copy the default theme into .vuepress/theme for customization.

  Run vuepress <command> --help for detailed usage of given command.

  Unknown command info.

Most helpful comment

I've just fixed by including "vuepress": "^1.0.0-alpha.48" on my package.json file and running yarn install

All 7 comments

Hi @ivandokov,
You might want to try the @next version of the plugin mentioned on the official docs page. I'm running this version of the plugin on my personal website and this example. Both are working for me as expected.

Same issue here

I've just fixed by including "vuepress": "^1.0.0-alpha.48" on my package.json file and running yarn install

Unfortunately I am not having your success. The contents of my package.json is as follows:

{
  "dependencies": {
    "@vuepress/plugin-google-analytics": "^1.0.0-alpha.48"
  }
}

and my config.js (as in the docs):

module.exports = {
    plugins: [
        ['@vuepress/google-analytics', {
            'ga': 'UA-29469126-4'
        }]
    ]
};

Yeah, it seems that the plugins must be included in the local package.json. For instance, this file works fine:

{
  "scripts": {
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  },
  "devDependencies": {
    "@vuepress/plugin-back-to-top": "^1.0.1",
    "@vuepress/plugin-google-analytics": "^1.0.1",
    "vuepress": "^1.0.1"
  }
}

It seems that this issue doesn't exist, please use the latest version of vuepress.

It seems that this issue doesn't exist, please use the latest version of vuepress.

@ulivz Wast me one night to make it work!!
Cannot resolve plugin ** when Vuepress is installed globally. You should put Vuepress locally.

Environment Info: [With question]
npmPackages:
@vuepress/core: Not Found
@vuepress/theme-default: Not Found
vuepress: Not Found
npmGlobalPackages:
vuepress: 1.0.2
Environment Info: [OK]
npmPackages:
@vuepress/core: 1.0.2
@vuepress/theme-default: 1.0.2
vuepress: ^1.0.2 => 1.0.2
npmGlobalPackages:
vuepress: 1.0.2

It's the solution:
I've just fixed by including "vuepress": "^1.0.0-alpha.48" on my package.json file and running yarn install

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ynnelson picture ynnelson  路  3Comments

sankincn picture sankincn  路  3Comments

AleksejDix picture AleksejDix  路  3Comments

gaomd picture gaomd  路  3Comments

lileiseven picture lileiseven  路  3Comments