nx icon indicating copy to clipboard operation
nx copied to clipboard

@nrwl/node:node crashes because `context.projectGraph` is undefined but `calculateProjectDependencies` expects it to be defined

Open DanielGiljam opened this issue 2 years ago • 2 comments

Current Behavior

@nrwl/node:node executor crashes because context.projectGraph is undefined but calculateProjectDependencies expects it to be defined.

Expected Behavior

@nrwl/node:node executor doesn't crash because context.projectGraph isn't a required property of ExecutorContext.

Steps to Reproduce

Execute @nrwl/node:node executor.

Failure Logs

> nx run create-test-data:serve --verbose=true


 >  NX   Cannot read properties of undefined (reading 'nodes')


TypeError: Cannot read properties of undefined (reading 'nodes')
    at calculateProjectDependencies (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/@nrwl/node/node_modules/@nrwl/workspace/src/utilities/buildable-libs-utils.js:17:30)
    at calculateResolveMappings (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/@nrwl/node/node_modules/@nrwl/js/src/executors/node/node.impl.js:61:86)
    at nodeExecutor_1 (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/@nrwl/node/node_modules/@nrwl/js/src/executors/node/node.impl.js:37:26)
    at nodeExecutor_1.next (<anonymous>)
    at resume (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/tslib/tslib.js:230:48)
    at /Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/tslib/tslib.js:229:125
    at new Promise (<anonymous>)
    at Object.i.<computed> [as next] (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/tslib/tslib.js:229:67)
    at Object.i.<computed> [as next] (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/tslib/tslib.js:240:99)
    at nodeExecutor_1 (/Users/Dadi/Desktop/Repositories/dice-10-000/node_modules/@nrwl/node/src/executors/node/node.impl.js:9:46)

 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Running target "create-test-data:serve" failed

   Failed tasks:
   
   - create-test-data:serve

Environment

   Node : 16.16.0
   OS   : darwin x64
   yarn : 3.2.2
   
   nx : 14.5.1
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.5.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.1
   @nrwl/eslint-plugin-nx : 14.5.1
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.1
   @nrwl/js : 14.5.1
   @nrwl/linter : 14.5.1
   @nrwl/nest : Not Found
   @nrwl/next : 14.5.1
   @nrwl/node : 14.7.5
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.5.1
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.5.1
   @nrwl/web : 14.5.1
   @nrwl/workspace : 14.5.1
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:

DanielGiljam avatar Sep 15 '22 10:09 DanielGiljam

https://github.com/nrwl/nx/blob/94f2fe0b326ca5341bf5e52b8bcf5fc16f982297/packages/js/src/executors/node/node.impl.ts#L69

DanielGiljam avatar Sep 15 '22 11:09 DanielGiljam

Hi Daniel, You're using too recent a @nrwl/node version compared to the rest of the @nrwl/* packages. You need to align them either by downgrading @nrwl/node to 14.5.1, or upgrading everything else to 14.7.5.

Phault avatar Sep 17 '22 18:09 Phault

Could you please align the versions of @nrwl/* packages and see if the issue still presents itself?

FrozenPandaz avatar Sep 23 '22 21:09 FrozenPandaz

Issue doesn't present itself when versions are aligned. Thanks for the help! 😊

DanielGiljam avatar Sep 26 '22 05:09 DanielGiljam

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

github-actions[bot] avatar Oct 11 '22 00:10 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Mar 21 '23 16:03 github-actions[bot]