【问题标题】:Why does this error appear when running Nrwl nx cli?为什么运行nrwl nx cli时会出现这个错误?
【发布时间】:2020-11-03 02:28:57
【问题描述】:

我一直在尝试学习和使用 nwrl nx 框架来创建带有角度应用程序的新单声道存储库。但是,当尝试将 nx cli 用于任何命令时,我收到以下错误:

    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.

每当我运行 nx 命令时都会出现此错误,例如

nx serve <app name>

npx ng serve <app name>

我尝试卸载并重新安装 nx cli 无济于事。任何帮助或建议将不胜感激

谢谢。

【问题讨论】:

    标签: compiler-errors command-line-interface monorepo nomachine-nx


    【解决方案1】:

    一位同事帮我解决了这个问题。问题是我的 tsconfig.json 文件中有一个尾随逗号,而 JSON 不允许尾随逗号。因此,如果您遇到类似的错误,请确保您的 nx/angular 项目中的主要 JSON 文件格式正确。

    【讨论】:

    • 有时是您的项目名称,例如:projeto.something 重命名为:projeto-something
    猜你喜欢
    • 2013-12-30
    • 2019-11-10
    • 1970-01-01
    • 2022-01-06
    • 2019-09-13
    • 2023-04-04
    • 2020-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多