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.

Cannot read properties of undefined (reading 'endsWith') local plugin

See original GitHub issue

Current Behavior

When I generate a local plugin and attempt to run it (or any Nx command), I get this error message

Cannot read properties of undefined (reading ‘endsWith’)

Expected Behavior

Nx commands should run and the local plugin should work as expected.

Steps to Reproduce

  1. Clone this github repo: https://github.com/AndrewOttavianoAbb/nx-plugin-test
  2. Run any Nx command: nx build test-lib
  3. Observe the error in the terminal

To create this repo, I generated it using version 13 (since we have a dependency on React 17 right now), generated a library, and then generated a plugin. I encountered the error after running an Nx command. This is an example repo of a bigger one that we created a while ago where I was trying to add a generator and ran into the same issue.

Failure Logs

NX Cannot read properties of undefined (reading ‘endsWith’)

Environment

   Node : 16.15.0
   OS   : win32 x64
   npm  : 8.0.0
   
   nx : 13.10.6
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.3
   @nrwl/eslint-plugin-nx : 13.10.6
   @nrwl/express : Not Found
   @nrwl/jest : 13.10.6
   @nrwl/js : 13.10.6
   @nrwl/linter : 13.10.6
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : 14.4.3
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 13.10.6
   typescript : 4.6.4
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AgentEndercommented, Aug 2, 2022

Hey @AndrewOttavianoAbb, it may be unrelated, but some of your @nrwl/* packages don’t line up with the version of nx you have installed. Aside from @nrwl/nx-cloud, all packages under the nrwl scope should generally be set up with the same version.

Can you correct this and check that the issue still reproduces? An easy way to fix this would be to run nx migrate {v}, where v is the version of nx you have installed. Alternatively, updating to latest with nx migrate latest would also work.

0reactions
AgentEndercommented, Oct 27, 2022

I’m going to go ahead and close this one out, it looks like this 8s just an out of sync deps issue for those involved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Yarn install error: NX Cannot read properties of undefined ...
I encount this issue a lot of times. Just remove the ".cache/nx" folder in your node_modules and re-run your command.
Read more >
nx cannot read properties of undefined (reading 'endswith')
When I generate a local plugin and attempt to run it (or any Nx command), I get this error message. Cannot read properties...
Read more >
How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
Read more >
TypeError: Cannot read property 'startsWith' of undefined
Then the error appears when i try to run node index.js inside src folder. if I replace the process.env.MOGNGO_CONNECTION_STRING variable by this ...
Read more >
Cannot read property 'endsWith' of undefined - Salesforce ...
Salesforce DX: Lightning testing service run with · November 23, 2017; ·; Reply · Reply · Like; 0; ·; Follow; 1 · Like;...
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