nuxt / nuxt/bridge

Default nuxt config missing `analyzeDir` value

Open
#1,032 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending triage
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
  • Operating System: Windows_NT
  • Node Version: v18.19.0
  • Nuxt Version: 2.17.2-28284499.5674f49
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: yarn@1.22.19
  • Builder: webpack
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -
Reproduction

Should be self-explanatory

Describe the bug

Running nuxi analyze results in

ERROR  The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

  at Object.rm (node:internal/fs/promises:722:38)
  at clearDir (node_modules/nuxi/dist/shared/nuxi.976cd438.mjs:11:20)
  at Object.run (node_modules/nuxi/dist/chunks/analyze.mjs:93:11)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1648:16)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1639:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.4fde776c.mjs:1773:7) 

The path here is the analyzeDir property in the nuxt config. This property does not seem to be assigned a default value ("/<rootDir>/.nuxt/analyze" as described in the nuxt docs), nor be resolved for example in the nitro config creation. buildDir is resolved in this case:

https://github.com/nuxt/bridge/blob/1fa3dce0df0c3122275a7d914ba7404b5fd01241/packages/bridge/src/nitro.ts#L67-L69

Additional context

Nitro enabled, Vite disabled.

When manually providing a value, nuxi analyze runs generates an html report.

    analyzeDir: "./.nuxt/analyze",

However, this default path seems to be conflicting with the 'Starting stats server' step.

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting packages/bridge/src/nitro.ts around the linked buildDir handling and compare how analyzeDir is created or resolved in the Nuxt config. Reproduce nuxi analyze with Nitro enabled and Vite disabled, then verify that the command produces an HTML report without an undefined path or the reported stats-server conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxt, typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.