nrwl / nx

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

Referencing an executor's package name in the same workspace doesn't work #10838

Closed jericopingul closed 2 years ago

jericopingul commented 2 years ago

Current Behavior

Referencing an executor's package name in the same workspace doesn't work

Expected Behavior

We should be able to reference like this in the same package image

Not sure if this is a regression.

Steps to Reproduce

More details in the slack thread here: https://nrwlcommunity.slack.com/archives/CMFKWPU6Q/p1655840406201759?thread_ts=1655827506.379309&cid=CMFKWPU6Q

github source code : https://github.com/jericopingul/nx-npm/tree/main/packages

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

Failure Logs

> nx run hello-tsc:my-executor

Cannot find module '/Users/jericopingul/projects/my-nx-npm/packages/my-nx-plugin/src/executors/my-executor/executor'
Require stack:
- /Users/jericopingul/projects/my-nx-npm/node_modules/nx/src/config/workspaces.js
- /Users/jericopingul/projects/my-nx-npm/node_modules/nx/src/command-line/run.js
- /Users/jericopingul/projects/my-nx-npm/node_modules/nx/bin/run-executor.js

 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target my-executor for project hello-tsc (297ms)

Environment

Dev environment nx cloud command error: https://nx.app/runs/YrXuu40QXOR

 >  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : darwin x64
   yarn : 1.22.4

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

✨  Done in 0.86s.
jericopingul commented 2 years ago

The solution is that removing workspaces in the root package.json and referencing by name @my-nx-npm/my-nx-plugin in the project.json fixes it and fixes the node_module resolution. Thank you @AgentEnder

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.