nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.28k stars 2.32k forks source link

npx create-nx-workspace@latest unsuccessful ("not an empty directory" error) #5428

Closed struffieux closed 3 years ago

struffieux commented 3 years ago

Current Behavior

npx create-nx-workspace@latest will not run as expected. An error occured.

The error is that the created directory is not empty. This does not exists before to start the command.

Expected Behavior

npx create-nx-workspace run without error

Steps to Reproduce

npx create-nx-workspace@latest --verbose

Failure Logs

[neo@ubuntu frontends (master #)]$ npx create-nx-workspace@latest --verbose npx: installed 48 in 8.749s ✔ Workspace name (e.g., org name) · heidi-frontend ✔ What to create in the new workspace · angular ✔ Application name · heidi-frontend ✔ Default stylesheet format · scss ✔ Default linter · eslint ✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

NX Nx is creating your workspace.

To make sure the command works reliably in all environments, and that the preset is applied correctly, Nx will run "npm install" several times. Please wait.

⠸ Creating your workspace

NX ERROR Something went wrong. Rerunning the command with verbose logging.

/home/neo/repos/ocd/heidi/frontends/heidi-frontend is not an empty directory. Error: /home/neo/repos/ocd/heidi/frontends/heidi-frontend is not an empty directory. at /tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/@nrwl/workspace/src/generators/new/new.js:127:19 at Generator.next () at /tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/tslib/tslib.js:117:75 at new Promise () at Object.__awaiter (/tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/tslib/tslib.js:113:16) at newGenerator (/tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/@nrwl/workspace/src/generators/new/new.js:111:20) at Object. (/tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/@nrwl/tao/src/commands/generate.js:142:36) at Generator.next () at fulfilled (/tmp/tmp-18220-0GM0Aq5lDAnf/node_modules/tslib/tslib.js:114:62)

NX ERROR Something went wrong! v12.0.8

Environment

Node : 14.16.1 OS : linux x64 npm : 6.14.12

nx : Not Found @nrwl/angular : 12.0.8 @nrwl/cli : 12.0.8 @nrwl/cypress : 12.0.8 @nrwl/devkit : 12.0.8 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 12.0.8 @nrwl/linter : 12.0.8 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 12.0.8 @nrwl/web : Not Found @nrwl/workspace : 12.0.8 @nrwl/storybook : Not Found @nrwl/gatsby : Not Found typescript : 4.1.5

andban commented 3 years ago

I had the same error. It seems to work for me when the command is executed inside a folder that is either empty, or contains only other nx workspaces.

Correction, it worked only because i deleted everything from the folder of the failed attempt, cd'ed into that directory and tryied it again:

$ npx create-nx-workspace test-nx # failure
$ rm -rf test-nx/*
$ cd test-nx
$ npx create-nx-workspace test-nx # success
benjamincharity commented 3 years ago

I just got my dev env set up on a new machine and I'm seeing this same type of error in empty directories.

I've tried:

// Report from inside the generated project
  Node : 15.7.0
  OS   : darwin arm64 (BigSur@11.2.3)
  Chip : Apple M1
  npm  : 7.4.3

  nx : Not Found
  @nrwl/angular : 11.6.3
  @nrwl/cli : 11.6.3
  @nrwl/cypress : 11.6.3
  @nrwl/devkit : 11.6.3
  @nrwl/eslint-plugin-nx : 11.6.3
  @nrwl/express : Not Found
  @nrwl/jest : 11.6.3
  @nrwl/linter : 11.6.3
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.6.3
  @nrwl/web : Not Found
  @nrwl/workspace : 11.6.3
  @nrwl/storybook : Not Found
  @nrwl/gatsby : Not Found
  typescript : 4.0.7

image

fwiw the project does seem to actually be set up correctly - I can serve it after etc.

DanHarman commented 3 years ago

I tried this with 12.0.7 as well, and same issue.

vsavkin commented 3 years ago

Thank you for reporting the issue. I fixed it here: https://github.com/nrwl/nx/commit/d72569a5e603cf83404b2d43726b0a444ab27a8c

The error message was misleading.

alexnoutashGTA commented 1 year ago

So shall we merge it ? Still getting the same error with the latest

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.