Подтвердить что ты не робот

Как я могу заниматься установкой равных зависимостей в Угловой CLI?

Я обнаружил себя в бесконечном цикле ошибок при попытке обновить свой Угловой CLI и NPM. Каждый раз, когда я обновляюсь, меня встречают сообщения WARN, в которых мне сообщают об установке одноранговых зависимостей (см. Ниже), но каждый раз, когда я устанавливаю зависимость, меня встречают более WARN-сообщения. Есть ли лучший способ справиться с этой ситуацией или серьезно ли это занимает часы?

npm WARN @angular/[email protected] requires a peer of @angular/[email protected] 
but none is installed. You must install peer dependencies yourself.
npm WARN @angular/[email protected] requires a peer of [email protected]>=2.4.2 
<2.6 but none is installed. You must install peer dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of 
@angular/[email protected]^4.0.3 but none is installed. You must install peer 
dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of 
@angular/[email protected]^4.0.3 but none is installed. You must install peer 
dependencies yourself.
npm WARN @ng-bootstrap/[email protected] requires a peer of 
@angular/[email protected]^4.0.3 but none is installed. You must install peer 
dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer dependencies 
yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer 
dependencies yourself.
npm WARN @schematics/[email protected] requires a peer of @angular-
devkit/[email protected] but none is installed. You must install peer dependencies 
yourself.
npm WARN [email protected] requires a peer of 
@angular/[email protected]^4.0.1 but none is installed. You must install peer 
dependencies yourself.
npm WARN [email protected] requires a peer of 
@angular/[email protected]^4.0.1 but none is installed. You must install peer 
dependencies yourself.
npm WARN [email protected] requires a peer of @angular/platform-
[email protected]^4.0.0 but none is installed. You must install peer dependencies 
yourself.
npm WARN [email protected] requires a peer of 
@angular/[email protected]^4.0.1 but none is installed. You must install peer 
dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 3 but none 
is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]^1.12.3 but 
none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/[email protected]^2.4.7 || ^4.0.0 
but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/[email protected]^2.4.0 || 
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/[email protected]^2.4.0 || 
^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]>=2.4.2 <2.6 but none 
is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
[email protected]: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"win32","arch":"x64"})

Я знаю, что я должен делать что-то неправильно, но я новичок в Angular.

4b9b3361

Ответ 1

Предупреждения о зависимости от сверстников чаще всего можно игнорировать. Единственный раз, когда вы захотите предпринять действия, это если полностью отсутствует одноранговая зависимость или если версия зависимости от однорангового узла выше, чем версия, которую вы установили.

Давайте возьмем это предупреждение в качестве примера:

npm WARN @angular/animations @5.2.1 требует однорангового соединения @angular/core @5.2.1, но ни один из них не установлен. Вы должны установить одноранговые зависимости самостоятельно.

С Angular вы хотите, чтобы используемые вами версии были согласованы во всех пакетах. Если есть какие-либо несовместимые версии, измените версии в вашем package.json и запустите npm install чтобы все они синхронизировались. Я склоняюсь к тому, чтобы мои версии Angular оставались на последней версии, но вам нужно будет убедиться, что ваши версии совместимы с любой версией Angular, которая вам требуется (которая может быть не самой последней).

В такой ситуации:

npm WARN [email protected] требует однорангового соединения @angular/core @^ 2.4.0 || ^ 4.0.0 но ни один не установлен. Вы должны установить одноранговые зависимости самостоятельно.

Если вы работаете с версией Angular выше 4.0.0, у вас, скорее всего, проблем не будет. Ничего не поделаешь с этим тогда. Если вы используете версию Angular под 2.4.0, то вам нужно запустить свою версию. Обновите package.json и запустите npm install или запустите npm install для конкретной версии, которая вам нужна. Как это:

npm install @angular/[email protected] --save

Вы можете не --save если вы используете npm 5.0.0 или выше, эта версия автоматически сохраняет пакет в разделе зависимостей package.json.

В этой ситуации:

npm ПРЕДУПРЕЖДЕНИЕ необязательное Пропуск необязательная зависимость: [email protected] (node_modules\fsevents): npm ПРЕДУПРЕЖДЕНИЕ notsup Пропуск необязательная зависимость: неподдерживаемая платформа для [email protected]: wanted {"os": "darwin", "arch": "any "} (current: {" os ":" win32 "," arch ":" x64 "})

Вы используете Windows, а fsevent требует OSX. Это предупреждение можно игнорировать.

Надеюсь, что это поможет, и получайте удовольствие от изучения Angular!

Ответ 2

Вы можете игнорировать предупреждения одноранговых зависимостей, используя флаг --force с Angular cli при обновлении зависимостей.

ng update @angular/cli @angular/core --force

Для полного списка вариантов, проверьте документы: https://angular.io/cli/update