Angular CLI에서 피어 종속성을 설치하려면 어떻게 해야 합니까?
Angular CLI 및 NPM을 업데이트하려고 할 때 거의 끝없는 오류가 발생했습니다.업데이트할 때마다 피어 종속성을 설치하라는 WARN 메시지가 표시되지만(아래 참조) 종속성을 설치할 때마다 더 많은 WARN 메시지가 표시됩니다.이 상황을 더 잘 처리할 수 있는 방법이 있습니까? 아니면 심각하게 몇 시간이나 걸립니까?
npm WARN @angular/animations@5.2.1 requires a peer of @angular/core@5.2.1
but none is installed. You must install peer dependencies yourself.
npm WARN @angular/compiler-cli@5.1.0 requires a peer of typescript@>=2.4.2
<2.6 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/core@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/common@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @ng-bootstrap/ng-bootstrap@1.0.0-beta.6 requires a peer of
@angular/forms@^4.0.3 but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/angular@0.1.17 requires a peer of @angular-
devkit/core@0.0.29 but none is installed. You must install peer dependencies
yourself.
npm WARN @schematics/angular@0.1.17 requires a peer of @angular-
devkit/schematics@0.0.52 but none is installed. You must install peer
dependencies yourself.
npm WARN @schematics/schematics@0.0.11 requires a peer of @angular-
devkit/core@0.0.22 but none is installed. You must install peer dependencies
yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/core@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/common@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of @angular/platform-
browser@^4.0.0 but none is installed. You must install peer dependencies
yourself.
npm WARN angular2-notifications@0.7.4 requires a peer of
@angular/animations@^4.0.1 but none is installed. You must install peer
dependencies yourself.
npm WARN bootstrap@4.0.0-beta.2 requires a peer of jquery@1.9.1 - 3 but none
is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.0.0-beta.2 requires a peer of popper.js@^1.12.3 but
none is installed. You must install peer dependencies yourself.
npm WARN ng2-toasty@4.0.3 requires a peer of @angular/core@^2.4.7 || ^4.0.0
but none is installed. You must install peer dependencies yourself.
npm WARN ngx-carousel@1.3.5 requires a peer of @angular/core@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-carousel@1.3.5 requires a peer of @angular/common@^2.4.0 ||
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsickle@0.25.5 requires a peer of typescript@>=2.4.2 <2.6 but none
is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
제가 뭔가 잘못하고 있다는 것을 알지만, 저는 앵귤러가 처음입니다.
피어 종속성 경고는 무시하는 경우가 많습니다.피어 종속성이 완전히 없거나 피어 종속성 버전이 설치한 버전보다 높은 경우에만 작업을 수행할 수 있습니다.
이 경고를 예로 들어 보겠습니다.
npm WARN @angular/animations@5.2.1에는 @angular/core@5.2.1의 피어가 필요하지만 설치되어 있지 않습니다.피어 종속성을 직접 설치해야 합니다.
Angular를 사용하면 사용 중인 버전이 모든 패키지에서 일관성을 유지할 수 있습니다.호환되지 않는 버전이 있으면 패키지의 버전을 변경합니다.json, and runnpm install
모두 동기화된 상태입니다.저는 Angular 버전을 최신 버전으로 유지하는 편이지만, Angular 버전(가장 최근 버전은 아닐 수도 있음)에 대해 버전이 일치하는지 확인해야 합니다.
이런 상황에서:
npm WARN ngx-carousel@1.3.5에는 @angular/core@^2.4.0 || ^4.0.0의 피어가 필요하지만 설치되어 있지 않습니다.피어 종속성을 직접 설치해야 합니다.
4.0.0보다 높은 Angular 버전으로 작업하는 경우 문제가 없을 수 있습니다.그럼 이건 어쩔 수 없죠.2.4.0에서 Angular 버전을 사용하는 경우 버전을 업그레이드해야 합니다.패키지를 업데이트합니다.json, and runnpm install
, 아니면 달리거나npm install
필요한 특정 버전이 필요합니다.다음과 같은 경우:
npm install @angular/core@5.2.3 --save
당신은 제외해도 됩니다.--save
npm 5.0.0 이상을 실행하는 경우 해당 버전은 패키지의 종속성 섹션에 패키지를 저장합니다.json 자동으로.
이 상황에서:
npm WARN Optional SKIPPING Optional Dependency: fseevents@1.1.3(node_modules\fseevents): npm WARN notsup SKIPPING Optional Dependency: fseevents@1.1.3에 지원되지 않는 플랫폼: {"os": "darwin", arch": "any"}(현재: {"os": "win32", arch": "x64"})
Windows를 실행하고 있으며 fsevent에는 OSX가 필요합니다.이 경고는 무시할 수 있습니다.
종속성을 업데이트할 때 Angular cli가 있는 --force 플래그를 사용하여 피어 종속성 경고를 무시할 수 있습니다.
ng update @angular/cli @angular/core --force
전체 옵션 목록은 문서: https://angular.io/cli/update 을 확인합니다.
각도(글로벌) 업데이트:
- 다음을 사용하여 업데이트합니다.
ng 업데이트 @patch/cli @patch/core
- 또는 각도를 제거하고 다시 설치합니다.
npm uninstall -g @angular/cli
npm install -g @angular/cli
그런 다음 이전 각도 프로젝트(로컬)를 사용하려면 다음을(를)
- 로
npm list
일부 종속성이 변경되어 다음 오류가 발생하는 경우:
ERR!, 일부 구성 요소 npm !에 필요합니다. : 에 한 한 에
프로젝트를 업데이트해야 한다는 뜻입니다.
- 그러면 새 프로젝트를 만들고 코드를 붙여넣고 모든 종속성을 다시 설치할 수 있습니다.
- 한 을 합니다 을 합니다에서 요구하는 모든 합니다.
npm list
:
npm install mydependencie
제가 발견한 것은npm install
Angular 프로젝트가 있는 디렉토리와 동일한 명령을 사용하면 이러한 경고가 제거됩니다.이유를 모르겠습니다.
특히, ng2-completer를 사용하려고 했습니다.
$ npm install ng2-completer --save
npm WARN saveError ENOENT: no such file or directory, open 'C:\Work\foo\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Work\foo\package.json'
npm WARN ng2-completer@3.0.3 requires a peer of @angular/common@>= 6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-completer@3.0.3 requires a peer of @angular/core@>= 6.0.0 but noneis installed. You must install peer dependencies yourself.
npm WARN ng2-completer@3.0.3 requires a peer of @angular/forms@>= 6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN foo No description
npm WARN foo No repository field.
npm WARN foo No README data
npm WARN foo No license field.
컴파일을 할 수 없습니다.다시 시도했을 때 이번에는 foo/foo_app에 있는 Angular 프로젝트 디렉토리에서 잘 작동했습니다.
cd foo/foo_app
$ npm install ng2-completer --save
NPM 패키지 라이브러리에는 패키지에 섹션이 있습니다.peerDependency라는 json 파일입니다.예를 들어, Angular 8에 내장된 라이브러리는 일반적으로 Angular 8을 종속성으로 나열합니다.이는 버전 8 이하를 실행하는 모든 사용자에게 진정한 종속성입니다.그러나 버전 8, 9, 10을 실행하는 사람들에게는 어떤 우려도 추구해야 하는지 의문입니다.
Angular Updates(각도 업데이트)에서 이러한 메시지를 안전하게 무시해 왔지만, 유닛 및 사이프러스 테스트도 있습니다!
언급URL : https://stackoverflow.com/questions/48626005/how-do-i-deal-with-installing-peer-dependencies-in-angular-cli
'programing' 카테고리의 다른 글
XmlInclude 또는 SoapInclude 특성을 사용하여 정적으로 알 수 없는 유형을 지정합니다. (0) | 2023.09.17 |
---|---|
ID가 다른 MySQL 선택 * (0) | 2023.09.17 |
RMySQL에서 결과 집합을 닫는 방법은? (0) | 2023.09.17 |
Objective-C는 16진수 문자열을 정수로 구문 분석합니다. (0) | 2023.09.17 |
Excel 스프레드시트 데이터를 VBA가 포함된 다른 Excel 스프레드시트로 가져오기 (0) | 2023.09.17 |