SnowdogApps / vuepress-plugin-pdf-export

Vuepress plugin for exporting as PDF without system wide dependencies suitable for headless environments
MIT License
29 stars 7 forks source link

Unknown command: export . #6

Closed lsnow99 closed 3 years ago

lsnow99 commented 3 years ago

Hi,

I've set up the plugin according to the Readme, but I am getting Unknown command: export . when I run yarn run vuepress export .

My folder structure is:

docs
   src
   package.json

(generated by the guide at https://vuepress.vuejs.org/guide/getting-started.html#prerequisites) and I am running from within the docs folder.

Igloczek commented 3 years ago

You should run vuepress export . not yarn run vuepress export .. If you want to avoid installing Vuepress globally, add a new script to package.json like this

{
  "scripts": {
    "export": "vuepress export ."
  }
}

and then you can use yarn export

lsnow99 commented 3 years ago

Hmm, I tried both of those but same issue

$ yarn run export
yarn run v1.22.10
$ vuepress export .
Unknown command: export .

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ yarn export
yarn run v1.22.10
$ vuepress export .
Unknown command: export .

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ yarn export .
yarn run v1.22.10
$ vuepress export . .
Unknown command: export . .

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.

Then I installed vuepress globally:

$ vuepress export .
Unknown command: export .

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.
Igloczek commented 3 years ago

Try vuepress export src

lsnow99 commented 3 years ago

No dice :/

$ yarn export src
yarn run v1.22.10
$ vuepress export . src
Unknown command: export . src

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.

error Command failed with exit code 1.

Here's my directory tree:

manual/
    docs/
        node_modules/
        src/
        package.json
Igloczek commented 3 years ago

You need to replace that . with src in package.json and then just yarn export

lsnow99 commented 3 years ago

Right, sorry I copied the wrong output

$ yarn export src
yarn run v1.22.10
$ vuepress export . src
Unknown command: export . src

tip Did you miss to specify the target docs dir? e.g. vuepress export [targetDir].
tip A custom command registered by a plugin requires VuePress to locate your site configuration like vuepress dev or vuepress build.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Igloczek commented 3 years ago

Okay, one more time :D

In package.json

{
  "scripts": {
    "export": "vuepress export src"
  }
}

an then in console yarn export

lsnow99 commented 3 years ago

Works! Thank you

freebuu commented 3 years ago

Hello! Same issue, export not work with Unknown command: export docs package.json:

  {
    "scripts": {
      "dev": "vuepress dev docs",
      "build": "vuepress build docs",
      "export": "vuepress export docs"
    },
  "devDependencies": {
    "@snowdog/vuepress-plugin-pdf-export": "^1.1.0"
  }
}

npm run dev and npm run build works fine

UPD: When i run npm run build - seen an warning: warning An error was encountered in plugin "@snowdog/vuepress-plugin-pdf-export"

Igloczek commented 3 years ago

@2618094 Could you please open a new issue and post the actual error message?

haifengkao commented 3 years ago

I have the same problem, but I solved it with

"scripts": {
    "docs:pdf": "npm run docs:build && cd docs && vuepress export ."
}

then yarn docs:pdf

Igloczek commented 3 years ago

@haifengkao Do you have VuePress installed globally? Did you try "docs:pdf": "vuepress export docs", ofc with vuepress added as a dependency?

I'm asking this questions, because your solutions seem to be a hack, not a proper way of handling this problem.

haifengkao commented 3 years ago

Do you have VuePress installed globally? <- No Did you try "docs:pdf": "vuepress export docs", ofc with vuepress added as a dependency? <- Yes, it works.

so the right steps are

  1. yarn add -D vuepress
  2. yarn add -D @snowdog/vuepress-plugin-pdf-export
  3. "scripts": {
    "docs:pdf": "vuepress export docs"
    }
    1. yarn docs:pdf