Reputation: 71
I've been trying to learn and use the nwrl nx framework in creating a new mono repo with angular applications. However, when trying to use the nx cli for any commands, I get the following error:
at JSON.parse (<anonymous>)
at Object.parseJsonWithComments (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/utils/fileutils.js:43:17)
at new TargetProjectLocator (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/core/target-project-locator.js:14:46)
at buildExplicitTypeScriptDependencies (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/core/project-graph/build-dependencies/explicit-project-dependencies.js:7:34)
at buildDependenciesFns.forEach (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/core/project-graph/project-graph.js:60:41)
at Array.forEach (<anonymous>)
at buildProjectGraph (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/core/project-graph/project-graph.js:60:26)
at Object.createProjectGraph (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/core/project-graph/project-graph.js:39:30)
at Object.<anonymous> (/Users/bendunc/Documents/MTC Apps/mtc-language/node_modules/@nrwl/workspace/src/command-line/run-one.js:15:46)
at Generator.next (<anonymous>)
(node:5280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5280) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I get this error whenever I run an nx command such as
nx serve <app name>
or
npx ng serve <app name>
I've tried uninstalling and reinstalling the nx cli to no avail. Any help or suggestion would be much appreciated
Thank you.
Upvotes: 0
Views: 5006
Reputation: 71
A colleague helped me solve the issue. The problem was a trailing comma in my tsconfig.json file and JSON doesn't allow for trailing commas. So, if you've got a similar error, make sure that your main JSON files in your nx/angular project are properly formatted.
Upvotes: 7