I am trying to serve my react app called frontend (it has been working previously) and I am not sure what has broken.
If anyone can shed any light on what may be the problem that would be awesome, here is my issue.
When I run "nx serve frontend" I get the error:
NX Cannot read properties of undefined (reading 'build')
and all I get out of adding --verbose is:
TypeError: Cannot read properties of undefined (reading 'build')
at readTargetOptions (/home/demo/project/node_modules/@nx/devkit/src/executors/read-target-options.js:21:61)
at getBuildOptions (/home/demo/project/node_modules/@nx/webpack/src/executors/dev-server/dev-server.impl.js:77:57)
at devServerExecutor (/home/demo/project/node_modules/@nx/webpack/src/executors/dev-server/dev-server.impl.js:19:68)
at devServerExecutor.next (<anonymous>)
at getLastValueFromAsyncIterableIterator (/home/demo/project/node_modules/nx/src/utils/async-iterator.js:13:27)
at iteratorToProcessStatusCode (/home/demo/project/node_modules/nx/src/command-line/run/run.js:41:94)
at /home/demo/project/node_modules/nx/src/command-line/run/run.js:154:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleErrors (/home/demo/project/node_modules/nx/src/utils/params.js:9:16)
at async process.<anonymous> (/home/demo/project/node_modules/nx/bin/run-executor.js:59:28)
I only have a nx.json in the root of the project and a separate project.json in the react app folder (front end).
It is really stumping me an any pointers would appreciated. Thanks.
If you have any projects listed in your nx.json, remove them. See github answer for the same issue: https://github.com/nrwl/nx/issues/20983