I'm trying to build an NX generator to generate a Probot app inside an NX workspace. But when I'm using the generator, for some reason I'm getting the following error:
PS C:\repos\testjews> nx generate @mintplayer/nx-generators:create-probot-app --verbose
> NX Unable to resolve @mintplayer/nx-generators:create-probot-app.
Cannot find module '@mintplayer/nx-generators/package.json'
Require stack:
- C:\repos\testjews\node_modules\nx\src\utils\package-json.js
- C:\repos\testjews\node_modules\nx\src\utils\package-manager.js
- C:\repos\testjews\node_modules\nx\bin\init-local.js
- C:\repos\testjews\node_modules\nx\bin\nx.js
- C:\Users\Pieterjan De Clippel\AppData\Roaming\npm\node_modules\nx\bin\nx.js
Error: Unable to resolve @mintplayer/nx-generators:create-probot-app.
Cannot find module '@mintplayer/nx-generators/package.json'
Require stack:
- C:\repos\testjews\node_modules\nx\src\utils\package-json.js
- C:\repos\testjews\node_modules\nx\src\utils\package-manager.js
- C:\repos\testjews\node_modules\nx\bin\init-local.js
- C:\repos\testjews\node_modules\nx\bin\nx.js
- C:\Users\Pieterjan De Clippel\AppData\Roaming\npm\node_modules\nx\bin\nx.js
at getGeneratorInformation (C:\repos\testjews\node_modules\nx\src\command-line\generate\generator-utils.js:39:15)
at C:\repos\testjews\node_modules\nx\src\command-line\generate\generate.js:218:248
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleErrors (C:\repos\testjews\node_modules\nx\src\utils\params.js:9:16)
Apparently there's a package.json
file that cannot be found.
These are the commands I ran to get to the current project containing the generators:
npx create-nx-workspace
> mintplayer-nx-plugins
> None
> Package-based monorepo
cd mintplayer-nx-plugins
npm i @nx/plugin@latest
nx g @nx/plugin:plugin nx-generators
code .
cd nx-generators
nx generate @nx/plugin:generator create-probot-app
> Derived
Additional resources:
It seems that when I first install the package manually
npm i @mintplayer/nx-generators
then run the generator
nx generate @mintplayer/nx-generators:create-probot-app
everything works as expected. But is there a way to omit the manual installation of this library, and let nx generate
handle that for me?
Just finished creating an NX Plugin with a Probot generator.