Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root is required with run-many #3907

Closed
GrandSchtroumpf opened this issue Oct 12, 2020 · 5 comments
Closed

root is required with run-many #3907

GrandSchtroumpf opened this issue Oct 12, 2020 · 5 comments

Comments

@GrandSchtroumpf
Copy link

Current Behavior

The "root" field is required with run-many

"examples": {
  "root": "dummy/path",
  "architect": {
    "serve": {
      "builder": "@nrwl/workspace:run-commands",
      "options": {
        "commands": [
          "ng serve example-1",
          "ng serve example-2 --port 4201"
        ],
        "parallel": true
      }
    }
  }
},

If I don't set the "root" field nx run-many target=serve --project=examples fails with "cannot read length of undefined".

Expected Behavior

Either root should not be mandatory or provide a clearer error message.

Steps to Reproduce

  1. Create nx workspace
  2. Add json example above in workspace.json and update nx.json
  3. run nx run-many target=serve --project=examples

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

TypeError: Cannot read property 'length' of undefined
    at ***\node_modules\@nrwl\workspace\src\core\project-graph\operators.js:67:57
    at Array.sort (<anonymous>)
    at Object.getSortedProjectNodes (***\node_modules\@nrwl\workspace\src\core\project-graph\operators.js:55:33)
    at new TargetProjectLocator (***\node_modules\@nrwl\workspace\src\core\target-project-locator.js:15:47)
    at buildExplicitTypeScriptDependencies (***\node_modules\@nrwl\workspace\src\core\project-graph\build-dependencies\explicit-project-dependencies.js:8:34)
    at ***\node_modules\@nrwl\workspace\src\core\project-graph\project-graph.js:60:41
    at Array.forEach (<anonymous>)
    at buildProjectGraph (***\node_modules\@nrwl\workspace\src\core\project-graph\project-graph.js:60:26)
    at Object.createProjectGraph (***\node_modules\@nrwl\workspace\src\core\project-graph\project-graph.js:40:30)
    at Object.<anonymous> (***\node_modules\@nrwl\workspace\src\command-line\run-many.js:17:46)

Environment

  nx : Not Found
  @nrwl/angular : 10.3.0
  @nrwl/cli : 10.3.0
  @nrwl/cypress : 10.3.0
  @nrwl/eslint-plugin-nx : 10.3.0
  @nrwl/express : Not Found
  @nrwl/jest : 10.3.0
  @nrwl/linter : 10.3.0
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 10.3.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 10.3.0
  @nrwl/web : 10.3.0
  @nrwl/workspace : 10.3.0
  typescript : 4.0.3
@vsavkin
Copy link
Member

vsavkin commented Oct 23, 2020

Hi there!

All targets in Nx have to belong to a project. There are no project-less targets. We discussed this feature several times, but it was never high enough priority. We will examine it again.

@vsavkin vsavkin added scope: core core nx functionality type: feature and removed type: bug labels Oct 23, 2020
@GrandSchtroumpf
Copy link
Author

I think it's ok not to support "project-less" targets. Then maybe improving the error message would help debugging. Something like : "The keys 'projectType' & 'root' are required".

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@dongyuwei
Copy link

project-less targets will be helpful for global tasks, for example lint(eslint and stylelint), we can config only one lint for all projects in workspace.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants