Rah*_*Jha 8 npm-start angular nrwl-nx
在尝试运行我的 Angular 13 内置应用程序时,抛出以下错误。不知道这是什么原因。任何帮助,将不胜感激。
错误:
"[error] Error: [readCachedProjectGraph] ERROR: No cached ProjectGraph is available.
If you are leveraging \`readCachedProjectGraph()\` directly then you will need to refactor your usage to first ensure that
the ProjectGraph is created by calling \`await createProjectGraphAsync()\` somewhere before attempting to read the data.
If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx
Make sure invoke 'node ./decorate-angular-cli.js' in your postinstall script.
The decorated CLI will compute the project graph.
'ng --help' should say 'Smart, Fast and Extensible Build System'.
at readCachedProjectGraph (C:\Project\xxxx\node_modules\nx\src\project-graph\project-graph.js:28:15)
at calculateResolveMappings (C:\Project\xxxxx\node_modules\@nrwl\node\src\executors\node\node.impl.js:57:62)
at nodeExecutor_1 (C:\Project\xxxxx\node_modules\@nrwl\node\src\executors\node\node.impl.js:34:26)
at nodeExecutor_1.next (<anonymous>)
at resume (C:\Project\xxxxx\node_modules\tslib\tslib.js:230:48)
at C:\Project\xxxxx\node_modules\tslib\tslib.js:229:125
at new Promise (<anonymous>)
at Object.i.<computed> [as next] (C:\Project\xxxxx\node_modules\tslib\tslib.js:229:67)
at recurse (C:\Project\xxxxx\node_modules\@nrwl\devkit\src\utils\convert-nx-executor.js:44:22)
at Observable._subscribe (C:\Project\xxxxx\node_modules\@nrwl\devkit\src\utils\convert-nx-executor.js:61:13)"
Run Code Online (Sandbox Code Playgroud)
对我来说,这是由于缺少 NX 缓存目录造成的。
我在 Gitlab 管道中遇到了这个错误,并通过添加一个小脚postinstall本来确保它被创建来解决它。
{
"scripts": {
"postinstall": "mkdir -p .nx"
}
}
Run Code Online (Sandbox Code Playgroud)