question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

extending "@nrwl/schematics"-"lib" produces "Cannot read property 'schematics' of undefined"

See original GitHub issue

Description

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:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
adrianbarwickicommented, Aug 11, 2020

The fix for this behaviour is to remove workspace.json.

0reactions
github-actions[bot]commented, Nov 11, 2020

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! 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ng add @nrwl/workspace throws Cannot read property 'paths ...
But I am getting the following error "Cannot read property 'paths' of undefined". I searched a bit in the internet and found out...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found