Current Behavior
I have created a new workspace to contain a mixture of projects, including simple Docker Compose and Python.
I initialised the workspace using npx nx init
I want to create my own Generators, so installed the plugin generator: ./nx add @nx/plugin
Trying to create my local plugin failed though: ./nx g @nx/plugin:plugin tools/my-plugin --verbose:
Error: Cannot find package.json
at readJson (/my_workspace/.nx/installation/node_modules/nx/src/generators/utils/json.js:16:15)
at getInstalledTypescriptVersion (/my_workspace/.nx/installation/node_modules/@nx/js/src/generators/init/init.js:17:51)
at initGeneratorInternal (/my_workspace/.nx/installation/node_modules/@nx/js/src/generators/init/init.js:112:42)
at initGenerator (/my_workspace/.nx/installation/node_modules/@nx/js/src/generators/init/init.js:46:12)
at libraryGeneratorInternal (/my_workspace/.nx/installation/node_modules/@nx/js/src/generators/library/library.js:38:41)
at libraryGenerator (/my_workspace/.nx/installation/node_modules/@nx/js/src/generators/library/library.js:29:18)
at pluginGeneratorInternal (/my_workspace/.nx/installation/node_modules/@nx/plugin/src/generators/plugin/plugin.js:52:48)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async /my_workspace/.nx/installation/node_modules/nx/src/command-line/generate/generate.js:240:26
at async handleErrors (/my_workspace/.nx/installation/node_modules/nx/src/utils/handle-errors.js:8:24)
Expected Behavior
There should be a tools/my-plugin created into which I can create my generators.
Since there is no package.json in the root of the workspace, I assume that it should be using the one in /my_workspace/.nx/installation/
GitHub Repo
https://github.com/flavour/nx_demo
Steps to Reproduce
./nx init
# Skip for now
./nx g @nx/plugin:plugin tools/my-plugin --verbose
# none, none
Nx Report
Node : 22.19.0
OS : linux-x64
Native Target : x86_64-linux
npm : 10.9.3
nx : 21.5.3
@nx/js : 21.5.3
@nx/jest : 21.5.3
@nx/eslint : 21.5.3
@nx/workspace : 21.5.3
@nx/devkit : 21.5.3
@nx/plugin : 21.5.3
typescript : 5.9.2
---------------------------------------
Cache Usage: 0.00 B / 42.36 GB
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
Current Behavior
I have created a new workspace to contain a mixture of projects, including simple Docker Compose and Python.
I initialised the workspace using
npx nx initI want to create my own Generators, so installed the plugin generator:
./nx add @nx/pluginTrying to create my local plugin failed though:
./nx g @nx/plugin:plugin tools/my-plugin --verbose:Expected Behavior
There should be a
tools/my-plugincreated into which I can create my generators.Since there is no
package.jsonin the root of the workspace, I assume that it should be using the one in/my_workspace/.nx/installation/GitHub Repo
https://github.com/flavour/nx_demo
Steps to Reproduce
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response