@ angular / compiler-cli 및 typescript의 버전을 확인할 수 없습니다. 이것에 대한 가장 일반적인 이유는 깨진 npm 설치입니다.

Nilesh Bhalerao

angular2에 내 프로젝트가 있지만 프로젝트를 실행하면 오류가 발생합니다.

@ angular / compiler-cli 및 typescript의 버전을 확인할 수 없습니다. 이에 대한 가장 일반적인 이유는 깨진 npm 설치입니다.

package.json에 devDependencies에 @ angular / compiler-cli 및 typescript가 모두 포함되어 있는지 확인한 다음 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

아래는 프로젝트를 실행하기 위해 찍은 stpes입니다.

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.

나는 이것에 많은 시간을 낭비했지만 해결책을 얻을 수 없습니다.

Alsami

종속성을 업데이트해야합니다. Angular-CLI 1.5+는 더 이상 Angular 2를 지원하지 않습니다. Angular 4 이상을 실행해야하며 Typescript 2.6 이상을 실행해야합니다. 새 프로젝트 단순 실행에 필요한 종속성을 확인하려면

ng new NewApp

편집 : 설명 : angular 2와 함께 angular-cli의 버전 1.6.8을 사용하려고합니다. Angular 2는 더 이상 해당 버전의 cli에서 지원되지 않습니다. 해당 패키지를 업데이트해야합니다. 그렇게하는 가장 좋은 방법은 cli를 사용하여 새 프로젝트를 만드는 것입니다. 다음을 수행

  1. 명령 프롬프트를 열고 컴퓨터의 특정 위치로 이동합니다.
  2. ng new SomeAppName 명령을 실행합니다. 여기서 SomeAppName은 새 프로젝트의 이름입니다. cli는 이제 해당 이름과 모든 최신 종속성을 가진 새 프로젝트 및 폴더를 생성합니다.
  3. 현재 작동하지 않는 프로젝트를 열고 package.json을 찾습니다.
  4. 새로 생성 된 프로젝트를 열고 package.json을 찾습니다.
  5. 3과 4의 package.json 파일을 비교하고 종속성을 업데이트하십시오.
  6. npm i 실행

다른 방법은 angular-cli를 버전 1.3으로 다운 그레이드하는 것입니다.

  1. npm uninstall -g @ angular / cli
  2. npm i -g @ angular / cli @ 1.3

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

TOP 리스트

뜨겁다태그

보관