Skip to content

Initialisation fails when rujnning in existing git sub-directory #2289

@rugk

Description

@rugk

Describe the bug

I guess a common use case is to "add an extension" for an existing website. This may done by running the init command in a sub-directory of an existing (git) project. This works, but only if you run it without having the sub-directory created first, for some reason.

Reproduction

See below

Steps to reproduce

Use an existing git repo of your choice and create an extension folder (mkdir extension), then go into it (cd extension ) and run:

$ npx wxt@latest init
                                                                                                                                                                          14:41:25
WXT 0.20.25
ℹ Initializing new project                                                                                                                                               14:41:25
√ Project Directory ... 
√ Choose a template » vue
√ Package Manager » npm
- Downloading template
[14:41:33]  WARN  Failed to move _gitignore to .gitignore: ENOENT: no such file or directory, rename 'data\extension\_gitignore' -> 'data\extension\.gitignore'

    at async rename (node:internal/fs/promises:782:10)
    at async cloneProject (***/_npx/a24d67041fb1761b/node_modules/wxt/dist/core/initialize.mjs:104:3)
    at async initialize (/***/_npx/a24d67041fb1761b/node_modules/wxt/dist/core/initialize.mjs:62:2)
    at async cli.command.option.option.action.wrapAction.disableFinishedLog (/***/_npx/a24d67041fb1761b/node_modules/wxt/dist/cli/commands.mjs:71:2)
    at async CAC.<anonymous> (/***/_npx/a24d67041fb1761b/node_modules/wxt/dist/cli/cli-utils.mjs:22:10)
    at async /***/_npx/a24d67041fb1761b/node_modules/wxt/dist/cli/index.mjs:11:1

√ Downloading template

✨ WXT project created with the vue template.                                                                                                                             14:41:33

Next steps:                                                                                                                                                               14:41:33
  1. npm install                                                                                                                                                          14:41:33

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 155H
    Memory: 3.69 GB / 31.51 GB
  Binaries:
    Node: 24.13.0 - C:\nvm4w\nodejs\node.EXE
    npm: 11.6.2 - C:\nvm4w\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (144.0.3719.82)
    Firefox: 149.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Firefox Developer Edition: 150.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
  npmPackages:
    vite: ^7.3.1 => 7.3.2

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions