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

Types aren't recognized if the project is setup with pnpm #9080

Open
4 of 7 tasks
onattech opened this issue Jun 18, 2023 · 2 comments · May be fixed by #9087
Open
4 of 7 tasks

Types aren't recognized if the project is setup with pnpm #9080

onattech opened this issue Jun 18, 2023 · 2 comments · May be fixed by #9087
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@onattech
Copy link

onattech commented Jun 18, 2023

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

If a project is initialized with pnpm, types aren't being recognized. This is not an issue with npm. Manually importing missing types fixes the errors. So I wanted to report this as it may be a bug. Tested it on latest 2.4.1 and canary Alpha3.0.0.

Reproducible demo

No response

Steps to reproduce

You may reproduce this issue by starting a new project with the command pnpm create docusaurus. Yes, I did select the typescript option during setup.

Expected behavior

It should recognize types similar to when installed with npm.

Actual behavior

Getting missing type errors.
image
image
Also getting errors for and not limited to node types, react types etc.

Solution
Manually installing types like so
image

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@onattech onattech added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jun 18, 2023
@2239559319 2239559319 linked a pull request Jun 20, 2023 that will close this issue
3 tasks
@albertothedev
Copy link
Contributor

It should be mentioned that, as is shown in the issue mentioned above, in version 3 of Docusaurus there are 2 type errors: one for @docusaurus/theme-classic and another for node. Installing @docusaurus/theme-classic fixes the former and installing @types/node fixes the latter. Both can be installed as development dependencies as a temporary fix to make the command pass.

@SalahAdDin
Copy link

It should be mentioned that, as is shown in the issue mentioned above, in version 3 of Docusaurus there are 2 type errors: one for @docusaurus/theme-classic and another for node. Installing @docusaurus/theme-classic fixes the former and installing @types/node fixes the latter. Both can be installed as development dependencies as a temporary fix to make the command pass.

Yeah, indeed it is a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants