You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular7与19混合项目:TS18003及依赖缺失问题排查

Angular 7与19混合依赖项目启动问题求助

背景

正在开发一个混合使用Angular 7与Angular 19包的项目,目标是通过ng serve成功运行项目。

问题

遇到以下两个错误:

  • 执行ng serve时,报错:"Could not find module '@angular-devkit/build-angular' from '...'."
  • 更新Node.js和Angular CLI后,报错:"TS18003: No inputs were found in config file 'tsconfig.json'."

已尝试操作

  • 将Node.js更新至18.20.5版本,确保与Angular CLI及其他依赖兼容
  • 调整angular.json和tsconfig.json配置:
    • 确认tsconfig.json的compilerOptions包含正确路径与输入项
    • 确认angular.json引用有效的构建器包
  • 清理并重新安装依赖:
    rm -rf node_modules
    npm install
    
  • 执行npm audit fix解决潜在依赖问题
  • 搜索并尝试网上类似问题的解决方案,但均未奏效

关键配置详情

package.json相关片段:

"dependencies": {
  "@angular/animations": "^7.2.16",
  "@angular/common": "^7.2.16",
  "@angular/compiler": "^19.0.0",
  "@angular/core": "^7.2.16",
  "@angular/forms": "^7.2.16",
  "@angular/platform-browser": "^7.2.16",
  "@angular/platform-browser-dynamic": "^19.0.0"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~15.0.0",
  "@angular/cli": "^19.0.0",
  "@angular/compiler-cli": "^19.0.0",
  "typescript": "~4.8.4"
}

angular.json相关片段:

"projects": {
  "app": {
    "architect": {
      "build": {
        "builder": "@angular-devkit/build-angular:browser"
      }
    }
  }
}

我的疑问

还能采取哪些步骤解决这些依赖与配置问题?是否需要将所有依赖降级至Angular 7,或有更好的版本混合方案?


内容的提问来源于stack exchange,提问作者Mike Zyto

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 21:12:33