nrwl / nx

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

`nx build` no longer reads default project when invoked at workspace root #10985

Closed StalkAltan closed 2 years ago

StalkAltan commented 2 years ago

Current Behavior

nx build invoked from workspace root results in Error: Both project and target to have to be specified when a default project is specified.

Expected Behavior

nx build should invoke the build target on the default project

Steps to Reproduce

=> npx create-nx-workspace@14.4 => Choose preset (I used Angular to repro) => Run nx build and observe error

Failure Logs

altan@pop-os:~/Code/nrwl/repros/nx144$ npx nx build
nx run [project][:target][:configuration] [_..]

Run a target for a project
(e.g., nx run myapp:serve:production).

You can also use the infix notation to run a target:
(e.g., nx serve myapp --configuration=production)

You can skip the use of Nx cache by using the --skip-nx-cache option.

Options:
      --version           Show version number                          [boolean]
      --prod              Use the production configuration
                                                      [boolean] [default: false]
  -c, --configuration     Target configuration                          [string]
      --project           Target project                                [string]
      --output-style      Defines how Nx emits outputs tasks logs
    [string] [choices: "dynamic", "static", "stream", "stream-without-prefixes",
                                                                      "compact"]
      --nx-bail           Stop command execution after the first failed task
                                                      [boolean] [default: false]
      --nx-ignore-cycles  Ignore cycles in the task graph
                                                      [boolean] [default: false]

Error: Both project and target to have to be specified
    at parseRunOneOptions (/home/altan/Code/nrwl/repros/nx144/node_modules/nx/src/command-line/run-one.js:76:15)
    at Object.<anonymous> (/home/altan/Code/nrwl/repros/nx144/node_modules/nx/src/command-line/run-one.js:20:22)
    at Generator.next (<anonymous>)
    at fulfilled (/home/altan/Code/nrwl/repros/nx144/node_modules/tslib/tslib.js:115:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Environment

NX Report complete - copy this into the issue template

Node : 16.15.0 OS : linux x64 npm : 8.5.5

nx : 14.4.0 @nrwl/angular : 14.4.0 @nrwl/cypress : 14.4.0 @nrwl/detox : Not Found @nrwl/devkit : 14.4.0 @nrwl/eslint-plugin-nx : 14.4.0 @nrwl/express : Not Found @nrwl/jest : 14.4.0 @nrwl/js : 14.4.0 @nrwl/linter : 14.4.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.4.0 @nrwl/web : 14.4.0 @nrwl/workspace : 14.4.0 typescript : 4.7.4

Community plugins:

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.