yarnpkg

Why 'docusaurus' is not recognized as an internal or external command?


I am trying to run a simple React project

yarn start

yarn run v1.22.22 docusaurus start 'docusaurus' is not recognized as an internal or external command, operable program or batch file. error Command failed with exit code 1.

Why?

yarn global list shows us

yarn global v1.22.22info "docusaurus@1.14.7" has binaries:docusaurus-startdocusaurus-builddocusaurus-publishdocusaurus-examplesdocusaurus-write-translationsdocusaurus-versiondocusaurus-rename-versionDone in 0.69s.

How can I solve this issue?

I am trying set up Docsaurus website,following the offical documentation text

I am providing my dependancies,and I am curious how they should look like.

  "devDependencies": {
    "@algolia/client-search": "^4.24.0",
    "@aws-sdk/client-s3": "^3.511.0",
    "@aws-sdk/credential-providers": "3.511.0",
    "@aws-sdk/signature-v4-crt": "^3.511.0",
    "@babel/helper-get-function-arity": "^7.16.7",
    "@docusaurus/core": "^2.4.1",
    "@docusaurus/preset-classic": "^2.4.1",
    "@docusaurus/theme-mermaid": "^2.4.1",
    "@mdx-js/react": "^1.6.21",
    "@types/react": "^16.8.0",
    "buffer": "^6.0.3",
    "cli-progress": "3.12.0",
    "clsx": "^2.0.0",
    "configure-webpack": "file:plugins/configure-webpack",
    "eslint": "9.2.0",
    "jest": "^29.7.0",
    "util": "^0.12.5",
    "webpack": "5.93.0"
  },
  "dependencies": {
    "mermaid": "^10.3.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.0",
    "rehype-katex": "5",
    "remark-math": "3"
  },

How should yarn provide more info of what really went wrong?


Solution

  • Try making sure both docusaurus core and classic are installed localy in your project

    yarn add @docusaurus/core @docusaurus/preset-classic
    

    additionally see if it starts with

    yarn add @docusaurus/core @docusaurus/preset-classic
    

    If that doesn't work id check package.json to make sure the start script is in there. Also sometimes I just run yarn install --force to reinstall all the dependencies