Skip to content

Can't create project inside existing dir #1768

Closed

Description

@asvetly

🐛 Bug Report

Error while creating project inside existing directory.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. mkdir test
  2. cd test
  3. npx @docusaurus/init@next init ./ classic

Expected behavior

Project is created inside test dir

Actual Behavior

~/Desktop $ mkdir test
~/Desktop $ cd test
~/D/test $ npx @docusaurus/init@next init ./ classic
npx: installed 59 in 12.719s
Error: Directory already exists at /Users/alexander/Desktop/test !
    at /Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/lib/index.js:72:19
    at Generator.next (<anonymous>)
    at /Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/lib/index.js:13:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/lib/index.js:9:12)
    at init (/Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/lib/index.js:48:12)
    at /Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/bin/index.js:31:5
    at Command.<anonymous> (/Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/bin/index.js:45:22)
    at Command.listener (/Users/alexander/.npm/_npx/45284/lib/node_modules/@docusaurus/init/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:203:13)

Activity

  1. added
    good first issue
    difficulty: starter
    on Sep 4, 2019
  2. gimdongwoo commented on Sep 10, 2019

    @gimdongwoo
    Contributor

    You executed the wrong command.
    Correct command parameter is below.
    npx @docusaurus/init@next init [name] [template]
    or
    npx @docusaurus/init@next init [name] [template] [rootDir]

  3. waldyrious commented on Aug 18, 2021

    @waldyrious
    Contributor

    I don't think @asvetly was confused about how to invoke the command. By the text he wrote, it seems clear he was trying to tell Docusaurus to use the current directory (./) as the base directory for the site, which is understandable since clearly Docusaurus by default takes the [name] parameter and creates a directory with that name. He was trying to reuse a directory that was already created — similar to how mkdir foo; cd foo; git init = git init foo. Unfortunately, this doesn't seem to be possible with Docusaurus.

    (And for those curious, using the [rootDir] parameter does not allow this either; it just allows for specifing a path, other than the current directory, where to create the [name] directory.)

  4. nathanagez commented on Oct 12, 2021

    @nathanagez

    @endiliey you should re-open this issue I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: startergood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions