【发布时间】:2019-06-20 22:12:24
【问题描述】:
我在 angular2 中的项目,但是当我运行项目时会产生以下错误
无法确定 @angular/compiler-cli 和 typescript 的版本。 最常见的原因是 npm 安装损坏。
请确保您的 package.json 包含 @angular/compiler-cli 和 typescript devDependencies,然后删除 node_modules 和 package-lock.json (如果你有的话)和 再次运行 npm install。
运行项目时出现此错误。以下是我的环境详细信息
Angular CLI: 1.6.8
Node: 8.2.1
OS: win32 x64
Angular: 5.2.4
... core
@angular/cli: 1.6.8
@angular/common: 2.2.3
@angular/compiler-cli: 2.4.10
@angular/compiler: 2.2.3
@angular/forms: 2.2.3
@angular/http: 2.2.3
@angular/platform-browser-dynamic: 2.2.3
@angular/platform-browser: 2.2.3
@angular/router: 3.1.2
@angular/tsc-wrapped: 0.5.2
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.0.2
webpack: 3.10.0
以下是我运行该项目的步骤
1)npm install -g @angular/cli@latest
2)npm install
3)ng serve
我的日志
Versions of @angular/compiler-cli and typescript could not be determined.
The most common reason for this is a broken npm install.
Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again.
我在这方面浪费了很多时间,但无法得到解决方案。如果有任何想法,请给我建议
【问题讨论】:
标签: angular