v2.5.2
Giriş yap

Npm uyum sorunu

canooo3
236 defa görüntülendi
    Running "npm install" in /home/expo/workingdir/build directory
npm
ERR! code ERESOLVE
npm
ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/graphql
npm ERR!   graphql@"^15.8.0" from the root project
npm ERR!
peer graphql@"^15.0.0 || ^16.0.0" from @apollo/[email protected]
npm ERR!   node_modules/@apollo/client
npm ERR!     @apollo/client@"^3.9.6" from the root project
npm ERR!   13 more (@expo/cli, @graphql-typed-document-node/core, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^14.3.1" from [email protected]
npm ERR! node_modules/react-apollo
npm ERR!   react-apollo@"^3.1.5" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/graphql
npm ERR!   peer graphql@"^14.3.1" from [email protected]
npm ERR!   node_modules/react-apollo
npm ERR!     react-apollo@"^3.1.5" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /home/expo/.npm/_logs/2024-05-01T06_37_32_532Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /home/expo/.npm/_logs/2024-05-01T06_37_32_532Z-debug-0.log
npm install exited with non-zero code: 1
    

bunun için napmalıyım npm install --force yaptım fakat yok

Cevap yaz
Cevaplar (6)
canooo3
154 gün önce

ebykdrms
zaten ben de
import { ApolloProvider } from '@apollo/client';
import { ApolloClient, InMemoryCache } from '@apollo/client';

olarak kullanıyordum

canooo3
155 gün önce

Tayfun abi onu yaptım fakat olmadı

tayfunerbilen
168 gün önce

legacy-peer-deps ile yuklemeyi denedin mi? bazi projelerde oldugu surumleriyle yukleme yapmak gerekebiliyor, bu flag hata vermeden yuklemeni sagliyor, legacy projelerde genelde kullaniyorum bende.

npm install --legacy-peer-deps
ebykdrms
168 gün önce

"@apollo/[email protected]" paketi "graphql@^16.8.1" sürümünü istiyor,
"@apollo/[email protected]" paketi "graphql@^14.3.1" sürümünü istiyor.

"@apollo/[email protected]" paketi "react@^18.2.0" sürümünü istiyor,
"@apollo/[email protected]" paketi "react@^16.8.0" sürümünü istiyor.

"[email protected]" paketi "graphql@^16.8.1" sürümünü istiyor,
"@urql/[email protected]" paketi "graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" sürümlerini istiyor.

Bu işi böyle çözemeyeceğiz diye düşünerek projenin repository'sini internette aradım.

Projenin Github sayfasına girince şu uyarıyı gördüm: THIS PROJECT HAS BEEN DEPRECATED
Bu yüzden güncel paketlerle uyum sorunları oluşuyor olabilir.

Proje sonlandırılıp yerine yenisi getirilmiş ve eski paketler yerine şu paketlerin yenileriyle değiştirilmesi önerilmiş:
old: @apollo/react-components --> new: @apollo/client/react/components
old: @apollo/react-hoc --> new: @apollo/client/react/hoc
old: @apollo/react-ssr --> new: @apollo/client/react/ssr
old: @apollo/react-testing --> new: @apollo/client/testing
old: @apollo/react-hooks --> new: @apollo/client

Bu geçişi en düzgün şekilde (projeye en az zarar verecek şekilde) yapabilmek için de yönergeler eklenmiş: https://www.apollographql.com/docs/react/migrating/apollo-client-3-migration/
Bunu uzun uzun inceyemedim. Yapay zekanın sayfayı özetlemesini istedim.
Verdiği çıktıyı direkt aşağıya yapıştırıyorum ama yine de link üzerinden gitmen daha sağlıklı olur.

Apollo Client 3.0'e geçiş yapmak için aşağıdaki adımları izleyebilirsin:

1) Paketleri Yükleme: Yeni paketleri yüklemek için aşağıdaki komutu çalıştır:

npm install @apollo/client

2) Paketleri Kaldırma: Daha önce "apollo-client", "apollo-boost" veya "react-apollo" paketlerini kullandıysan, bunları projenden kaldır:

npm uninstall apollo-client apollo-boost react-apollo

3) İçe Aktarmaları Güncelle: Kodundaki tüm "apollo-client" ve "apollo-boost" içe aktarmalarını "@apollo/client" ile değiştir. Örneğin:

import { useQuery, useMutation } from '@apollo/client';

4) Sunucu Tarafı İşleme (SSR): SSR işlevlerini kullanıyorsan, bunları yeni konumlarından içe aktar:

import { getDataFromTree } from '@apollo/client/react/ssr';

5) Test Etme: Test bileşenlerini kullanıyorsan, bunları yeni konumlarından içe aktar:

import { MockedProvider } from '@apollo/client/testing';

6) Bağlantılar: Bağlantılar artık "@apollo/client" paketinin bir parçasıdır. Bağlantıları içe aktarmak için daha spesifik olman gerekebilir:

import { createHttpLink } from '@apollo/client';
import { createPersistedQueryLink } from '@apollo/client/link/persisted-queries';

7) Otomatik Dönüştürme: Kod tabanın büyükse, Apollo'nun sağladığı otomatik dönüştürme aracını kullanabilirsin:
1- Apollo Client deposunu kopyala:

git clone https://github.com/apollographql/apollo-client.git

2- JSCodeshift aracını kullanarak içe aktarmaları dönüştür:

npx jscodeshift -t apollo-client/codemods/ac2-to-ac3/imports.js --extensions js source-directory

Burada "source-directory", dönüştürmek istediğin dosyaları içeren klasörün yoludur.

8) Diğer Paketler: Diğer paketleri (örneğin "apollo-link", "apollo-cache-inmemory") kullanıyorsan, bunları "@apollo/client" paketine taşıman gerekebilir.
Daha fazla bilgi için Apollo Client belgelerine bakabilirsin.

canbey3
168 gün önce

ŞİMDİDE BU HATAYI ALIYORUM

Running "npm install" in /home/expo/workingdir/build directory
npm
WARN ERESOLVE overriding peer dependency
npm
WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN
node_modules/graphql
npm WARN graphql@"^16.8.1" from the root project
npm WARN 4 more (@apollo/client, @graphql-typed-document-node/core, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-common
npm
WARN @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 4 more (@apollo/react-hoc, @apollo/react-hooks, ...)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-common
npm WARN @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 4 more (@apollo/react-hoc, @apollo/react-hooks, ...)
npm WARN ERESOLVE
overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 21 more (@apollo/client, @jsamr/react-native-li, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-common
npm WARN
@apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 4 more (@apollo/react-hoc, @apollo/react-hooks, ...)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-common
npm WARN @apollo/react-common@"^3.1.4" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 4 more (@apollo/react-hoc, @apollo/react-hooks, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN graphql@"^16.8.1" from the root project
npm WARN 4 more (@apollo/client, @graphql-typed-document-node/core, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN @apollo/react-components@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN 1 more (react-apollo)
npm WARN
npm
WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN @apollo/react-components@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN 1 more (react-apollo)
npm
WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 21 more (@apollo/client, @jsamr/react-native-li, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN @apollo/react-components@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN 1 more (react-apollo)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN @apollo/react-components@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN 1 more (react-apollo)
npm WARN ERESOLVE overriding peer dependency
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN graphql@"^16.8.1" from the root project
npm WARN 4 more (@apollo/client, @graphql-typed-document-node/core, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN @apollo/react-hoc@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN @apollo/react-hoc@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 21 more (@apollo/client, @jsamr/react-native-li, ...)
npm WARN
npm WARN
Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN @apollo/react-hoc@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hoc
npm WARN @apollo/react-hoc@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN ERESOLVE
overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN graphql@"^16.8.1" from the root project
npm WARN
4 more (@apollo/client, @graphql-typed-document-node/core, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hooks
npm WARN @apollo/react-hooks@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 2 more (@apollo/react-ssr, react-apollo)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^14.3.1" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hooks
npm WARN @apollo/react-hooks@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 2 more (@apollo/react-ssr, react-apollo)
npm WARN ERESOLVE
overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 21 more (@apollo/client, @jsamr/react-native-li, ...)
npm
WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hooks
npm WARN @apollo/react-hooks@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 2 more (@apollo/react-ssr, react-apollo)
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-hooks
npm WARN @apollo/react-hooks@"^3.1.5" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-components
npm WARN 2 more (@apollo/react-ssr, react-apollo)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @apollo/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 21 more (@apollo/client, @jsamr/react-native-li, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-ssr
npm WARN @apollo/react-ssr@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN peer react@"^16.8.0" from @apollo/[email protected]
npm WARN node_modules/@apollo/react-ssr
npm WARN @apollo/react-ssr@"^3.1.5" from [email protected]
npm WARN node_modules/react-apollo
npm WARN
ERESOLVE overriding peer dependency
npm WARN While resolving: @urql/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN graphql@"^16.8.1" from the root project
npm WARN 4 more (@apollo/client, @graphql-typed-document-node/core, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from @urql/[email protected]
npm WARN node_modules/@urql/exchange-retry
npm WARN @urql/exchange-retry@"0.3.0" from @expo/[email protected]
npm WARN node_modules/@expo/cli
npm WARN
npm
WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from @urql/[email protected]
npm WARN node_modules/@urql/exchange-retry
npm WARN @urql/exchange-retry@"0.3.0" from @expo/[email protected]
npm WARN node_modules/@expo/cli
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/graphql
npm ERR! graphql@"^16.8.1" from the root project
npm ERR! peer graphql@"^15.0.0 || ^16.0.0" from @apollo/[email protected]
npm ERR! node_modules/@apollo/client
npm ERR! @apollo/client@"^3.9.6" from the root project
npm ERR! 3 more (@graphql-typed-document-node/core, @urql/core, graphql-tag)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from [email protected]
npm ERR! node_modules/apollo-boost
npm ERR! apollo-boost@"^0.4.9" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/graphql
npm ERR! peer graphql@"^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0" from [email protected]
npm ERR! node_modules/apollo-boost
npm ERR! apollo-boost@"^0.4.9" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR!
to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/expo/.npm/_logs/2024-05-02T18_05_50_538Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /home/expo/.npm/_logs/2024-05-02T18_05_50_538Z-debug-0.log
npm install exited with non-zero code: 1

ebykdrms
169 gün önce

Aldığın hata mesajından anlaşılan o ki,
react-apollo paketi, graphql paketinin "^14.3.1" sürümünü gerektiriyor.
@apollo/client paketi de graphql paketinin "^15.0.0" veya "^16.0.0" sürümünü gerektiriyor.
Bu çakışma nedeniyle npm, graphql paketinin hangi sürümüne karar vereceğini bilemiyor.

Sorun olmayacaksa, graphql paketinin güncel sürümünü yüklersen çakışma çözülür gibi görünüyor.
Bunun için package.json dosyandaki dependencies bölümünde graphql sürümünü bulup güncel sürümü verebilirsin. Örn:

"dependencies": {
    "react-apollo": "^3.1.5",
    "@apollo/client": "^3.9.6"
    "graphql": "^16.8.1",
}

İşe yarar mı bilmem tabi.