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.

I'm trying to run nx serve <project> and get: NX Cannot read properties of undefined

See original GitHub issue

Current Behavior

Migration to v13. After that, when running “nx serve <project>” I got: NX Cannot read properties of undefined ('reading endsWith')

Also: NX As of Nx 13, project configuration should be moved from nx.json to workspace.json/project.json. Please run "nx format" to fix this.

Running “nx format”:

      NX   Affected criteria defaulted to --base=main --head=HEAD
      NX   Nx Daemon was not able to compute the project graph.
         Log file with the error: /Users/Arturo/aclprojects/acl-customers/node_modules/.cache/nx/d/daemon-error.log
         Please file an issue at https://github.com/nrwl/nx
         Nx Daemon is going to be disabled until you run "nx reset".
      
      NX As of Nx 13, project configuration should be moved from nx.json to workspace.json/project.json. Please run "nx format" to fix this.
      NX   Cannot read properties of undefined (reading 'endsWith')`

Expected Behavior

My service running

Steps to Reproduce

nx serve <project> after migration to v13. nx format

Failure Logs

daemon-error.log daemon.log

Environment

      NX   Report complete - copy this into the issue template
  
      Node : 16.13.1
      OS   : darwin x64
      yarn : 1.22.15
     
      nx : 13.8.1
     @nrwl/angular : 13.8.1
     @nrwl/cli : 13.8.1
     @nrwl/cypress : 13.8.1
     @nrwl/detox : undefined
     @nrwl/devkit : 13.8.1
     @nrwl/eslint-plugin-nx : 13.8.1
     @nrwl/express : undefined
     @nrwl/jest : 13.8.1
     @nrwl/js : undefined
     @nrwl/linter : 13.8.1
     @nrwl/nest : undefined
     @nrwl/next : undefined
     @nrwl/node : undefined
     @nrwl/nx-cloud : undefined
     @nrwl/react : undefined
     @nrwl/react-native : undefined
     @nrwl/schematics : undefined
     @nrwl/storybook : 13.8.1
     @nrwl/tao : 13.8.1
     @nrwl/web : undefined
     @nrwl/workspace : 13.8.1
     typescript : 4.5.5
     rxjs : 7.5.4
     ---------------------------------------
     Community plugins:
 @angular/animations: 13.2.2
 @angular/cdk: 13.2.2
 @angular/common: 13.2.2
 @angular/compiler: 13.2.2
 @angular/core: 13.2.2
 @angular/forms: 13.2.2
 @angular/material: 13.2.2
 @angular/platform-browser: 13.2.2
 @angular/platform-browser-dynamic: 13.2.2
 @angular/router: 13.2.2
 angular-datatables: 13.0.1
 ngx-spinner: 13.1.1
 @angular-devkit/build-angular: 13.2.3
 @angular/cli: 13.2.3
 @angular/compiler-cli: 13.2.2
 @angular/language-service: 13.2.2

      (node:18220) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/Arturo/aclprojects/acl-customers/node_modules/tslib/package.json.
      Update this package.json to use a subpath pattern like "./*".
      (Use `node --trace-deprecation ...` to show where the warning was created)`

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

28reactions
ivaylozhekovcommented, Apr 7, 2022

Hi @alo,

I hit the same issue migrating from angular & @nrwl v12 to v13. I debugged a little bit and found out that in nx.json, the ‘root’ property for each projects object should be present /as @leosvelperez suggested/

nx.json:

...
"projects": {
        "your-lib-name-1": {
            "tags": [],
            "root": "<the root of the lib>" <<<--- same root listed for the lib in angular.json
        },
        ...
}
...

after this, you may need to run the nx format command I hope this helps. At least it solved my issue.

12reactions
leosvelperezcommented, Mar 15, 2022

Thanks for reporting this!

I had a look at the stack traces shared by @amakhrov here and the one in the daemon.log file shared by @aclarturocastro. Checking the source code, it looks like you might have a project in your configuration with no value specified for the root property. That property is required and therefore, it would cause issues when it’s not present.

Please make sure that all projects always have a root property set in the configuration.

I’ll close this issue since it seems to be caused by an invalid configuration and in some cases seem to be because the migrations were not run. Please feel free to reopen this if the above doesn’t fix the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NX Cannot read properties of undefined (reading 'endsWith')
NX Failed to run update-ngcc-postinstall from @nrwl/angular. This workspace is NOT up to date! NX rule is not a function. So I set...
Read more >
nx cannot read properties of undefined (reading 'endswith')
I have nx 14.4.3 version in my system. And when I run nx serve it gives me the error :- TypeError: Cannot read...
Read more >
nrwl-nx/community - Gitter
I am trying to test a fetch endpoint but am running into cors issue. is there a way to create a https server...
Read more >
Project Configuration - Nx
Projects can be configured in package.json (if you use npm scripts and not Nx executors) and project.json (if you use task executors). Both...
Read more >
@Nrwl/Community
Hello I'm trying to run ng g @nrwl/nx-plugin:plugin snd-cypress-e2e ... 8 to 9 when trying to serve an angular application ERROR in Cannot...
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