docusaurus: The "paths[1]" argument must be of type string.

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

error while running dev server

user@users-MacBook-Pro docs.lokal.so % npm run start

> docs-lokal-so@0.0.0 start
> docusaurus start

[INFO] Starting the development server...

[ERROR] TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined
    at validateString (node:internal/validators:162:11)
    at Object.resolve (node:path:1101:7)
    at Object.pluginContentBlog [as plugin] (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/plugin-content-blog/lib/index.js:51:37)
    at initializePlugin (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/server/plugins/init.js:83:61)
    at async Promise.all (index 1)
    at async initPlugins (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/server/plugins/init.js:91:21)
    at async /Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/server/plugins/plugins.js:136:36
    at async loadSite (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/server/site.js:135:45)
    at async createReloadableSite (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/commands/start/utils.js:50:16)
    at async Command.start (/Users/user/Documents/Business/lokal.so/docs.lokal.so/node_modules/@docusaurus/core/lib/commands/start/start.js:22:28) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Reproducible demo

No response

Steps to reproduce

  1. install @latest docusaurus on 5 June 2024 (GMT+7)
  2. init docusaurus project with javascript
  3. run npm run start

Expected behavior

dev server running

Actual behavior

erroring

TypeError [ERR_INVALID_ARG_TYPE]: The “paths[1]” argument must be of type string. Received undefined

Your environment

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

Self-service

  • I’d be willing to fix this bug myself.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 13
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Hi all. jiti@1.21.2 was released as a hotfix for this issue. You can remove the resolution and upgrade your lock file to receive the fix 🤞🏼

This is a non-retro compatible update in Jiti v1.21.1, the tool we use to load plugin module graphs.

https://github.com/unjs/jiti/issues/237

Reverting to Jiti v1.21.0 fixes the problem.

Make sure you don’t have the problematic version of Jiti in your lock file.

yarn users can use the following:

  "resolutions": {
    "jiti": "1.21.0"
  },

I’d encourage you to downgrade Jiti rather than try to find another workaround because other things might be broken as well.

Note: if you don’t have a lockfile, you should really have one to prevent such issues from randomly appearing in your project. This kind of problem should only happen when you upgrade site dependencies.

Also hitting this error today

adding

          authorsMapPath: '',

to blog config section solves part of the problem with docusaurus write-translations that casues this, but I’m digging further

Confirming - I no longer see the issue on fresh installs or existing installs without the constraint or explicit dependency.

Hey this is the issue: https://github.com/unjs/jiti/releases/tag/v1.21.1

I guess there were some breaking changes

edit: damn, 8 minutes too late

@slorber you don’t provide a lock file, thus the dependencies will be resolved according to your package’s package.json file, where the version for jiti is ^

tried using typescript, with no success, it seems even when forcing the use of 3.3.2, 3.3.0 or even 3.2 I got the same error.

Would that be a dependency problem ?