通过 Anghular tuturial 如何在https://angular.io/tutorial/toh-pt6 中使用 http 请求 ,我到了这一点:
使用以下命令生成类 src/app/in-memory-data.service.ts:ng generate service InMemoryData
然后我遇到了这个问题,知道如何解决它吗?
编译失败。./src/app/in-memory-data.service.ts 模块构建失败(来自 ./node_modules/@ngtools/webpack/src/index.js):错误:/home/nart/Documents/MachineTranslation/open-translate TypeScript 编译中缺少 /src/app/in-memory-data.service.ts。请通过“文件”或“包含”属性确保它在您的 tsconfig 中。在 AngularCompilerPlugin.getCompiledFile (/home/nart/Documents/MachineTranslation/open-translate/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:935:23) 在 /home/nart/Documents/MachineTranslation/open-translate/node_modules /@ngtools/webpack/src/loader.js:42:31 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)
这是 tsconfig.json
/*
This is a "Solution Style" tsconfig.json file, and is used by editors and TypeScript’s language server to improve development experience.
It is not intended to be used to perform a compilation.
To learn more about this file see: https://angular.io/config/solution-tsconfig.
*/
{
"files": …Run Code Online (Sandbox Code Playgroud)angular ×1