extending "@nrwl/schematics"-"lib" produces "Cannot read property 'schematics' of undefined"
See original GitHub issueDescription
We cannot execute the lib schematic when running our own schematic (that is extending the lib schematic) as a node_modules package in another repo. We are getting the error Cannot read property 'schematics' of undefined
when this line of code is executed:
externalSchematic("@nrwl/schematics", "lib", {name: "foo", style: "scss"}),
Where exactly, we don’t know; there is no stacktrace.
It seems the problem is not with the packaging - we can use our schematic in our main repo from node_modules; only when importing the module via verdaccio in another repo, it occurs.
We tried using "@nrwl/workspace"
instead of "@nrwl/schematics"
but that fails with Cannot read property 'architect' of undefined
Considering the complicated environment, we can’t really provide a minimal example for you to reproduce, but perhaps you have some advice what might be the problem or how to debug this?
Environment
@nrwl/angular : 8.11.1
@nrwl/cli : 9.3.0
@nrwl/cypress : 8.11.1
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.3.0
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : 8.12.11
@nrwl/tao : 9.3.0
@nrwl/web : Not Found
@nrwl/workspace : 9.3.0
typescript : 3.5.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
The fix for this behaviour is to remove
workspace.json
.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! 🙏