Discussions

Erreur en installant axios

Image

Bonjour,

 

j'ai plusieurs erreurs lorsque j'essaye d'installer axios.

Que dois-je faire? Voici le message:

 

npm install --save axios

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR! 

npm ERR! While resolving: @testing-library/react@13.4.0

npm ERR! Found: react@16.14.0

npm ERR! node_modules/react

npm ERR!   peer react@"^16.14.0" from react-dom@16.14.0

npm ERR!   node_modules/react-dom

npm ERR!     peer react-dom@">= 16.8.0" from styled-components@5.3.6

npm ERR!     node_modules/styled-components

npm ERR!       peer styled-components@">= 2" from babel-plugin-styled-components@2.0.7

npm ERR!       node_modules/babel-plugin-styled-components

npm ERR!         babel-plugin-styled-components@">= 1.12.0" from styled-components@5.3.6

npm ERR!       1 more (the root project)

npm ERR!     react-dom@"^16.14.0" from the root project

npm ERR!   peer react@">= 16" from react-scripts@4.0.2

npm ERR!   node_modules/react-scripts

npm ERR!     react-scripts@"4.0.2" from the root project

npm ERR!   2 more (styled-components, the root project)

npm ERR! 

npm ERR! Could not resolve dependency:

npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR! node_modules/@testing-library/react

npm ERR!   @testing-library/react@"^13.4.0" from the root project

npm ERR! 

npm ERR! Conflicting peer dependency: react@18.2.0

npm ERR! node_modules/react

npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR!   node_modules/@testing-library/react

npm ERR!     @testing-library/react@"^13.4.0" 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! See /Users/dx/.npm/eresolve-report.txt for a full report.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/dx/.npm/_logs/2022-12-07T13_56_46_736Z-debug-0.log

7 réponses
Image
Louis-Nicolas Leuillet
Le 08/12/2022 à 08:15

Bonjour Dylann

 

Peux-tu installer Axios en version 2.0.5 ?

 

npm install axios@2.0.5
Image
Dylann XAVERO
Le 08/12/2022 à 11:36

J'ai toujours des erreurs :

 

npm install axios@2.0.5

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR! 

npm ERR! While resolving: @testing-library/react@13.4.0

npm ERR! Found: react@16.14.0

npm ERR! node_modules/react

npm ERR!   peer react@"^16.14.0" from react-dom@16.14.0

npm ERR!   node_modules/react-dom

npm ERR!     peer react-dom@">= 16.8.0" from styled-components@5.3.6

npm ERR!     node_modules/styled-components

npm ERR!       peer styled-components@">= 2" from babel-plugin-styled-components@2.0.7

npm ERR!       node_modules/babel-plugin-styled-components

npm ERR!         babel-plugin-styled-components@">= 1.12.0" from styled-components@5.3.6

npm ERR!       1 more (the root project)

npm ERR!     react-dom@"^16.14.0" from the root project

npm ERR!   peer react@">= 16" from react-scripts@4.0.2

npm ERR!   node_modules/react-scripts

npm ERR!     react-scripts@"4.0.2" from the root project

npm ERR!   2 more (styled-components, the root project)

npm ERR! 

npm ERR! Could not resolve dependency:

npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR! node_modules/@testing-library/react

npm ERR!   @testing-library/react@"^13.4.0" from the root project

npm ERR! 

npm ERR! Conflicting peer dependency: react@18.2.0

npm ERR! node_modules/react

npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR!   node_modules/@testing-library/react

npm ERR!     @testing-library/react@"^13.4.0" 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! See /Users/chonchon/.npm/eresolve-report.txt for a full report.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/chonchon/.npm/_logs/2022-12-08T11_34_39_400Z-debug-0.log

Image
Louis-Nicolas Leuillet
Le 09/12/2022 à 07:43

Voici la version que j'utilise dans le cours (je pensais que la version que je vous ai donné fonctionnerait)

npm install axios@0.21.1

Image
Dylann XAVERO
Le 09/12/2022 à 12:46

C'est toujours pareil :

 

npm install axios@0.21.1

npm ERR! code ERESOLVE

npm ERR! ERESOLVE could not resolve

npm ERR! 

npm ERR! While resolving: @testing-library/react@13.4.0

npm ERR! Found: react@16.14.0

npm ERR! node_modules/react

npm ERR!   peer react@"^16.14.0" from react-dom@16.14.0

npm ERR!   node_modules/react-dom

npm ERR!     peer react-dom@">= 16.8.0" from styled-components@5.3.6

npm ERR!     node_modules/styled-components

npm ERR!       peer styled-components@">= 2" from babel-plugin-styled-components@2.0.7

npm ERR!       node_modules/babel-plugin-styled-components

npm ERR!         babel-plugin-styled-components@">= 1.12.0" from styled-components@5.3.6

npm ERR!       1 more (the root project)

npm ERR!     react-dom@"^16.14.0" from the root project

npm ERR!   peer react@">= 16" from react-scripts@4.0.2

npm ERR!   node_modules/react-scripts

npm ERR!     react-scripts@"4.0.2" from the root project

npm ERR!   2 more (styled-components, the root project)

npm ERR! 

npm ERR! Could not resolve dependency:

npm ERR! peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR! node_modules/@testing-library/react

npm ERR!   @testing-library/react@"^13.4.0" from the root project

npm ERR! 

npm ERR! Conflicting peer dependency: react@18.2.0

npm ERR! node_modules/react

npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.4.0

npm ERR!   node_modules/@testing-library/react

npm ERR!     @testing-library/react@"^13.4.0" 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! See /Users/chonchon/.npm/eresolve-report.txt for a full report.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/chonchon/.npm/_logs/2022-12-09T12_44_56_162Z-debug-0.log

Image
Louis-Nicolas Leuillet
Le 09/12/2022 à 13:57

Est-ce possible d'avoir votre fichier composer.json ?

Image
Dylann XAVERO
Le 09/12/2022 à 15:00

Je ne trouve pas ce fichier, du coup je te mets un lien du projet entier : https://drive.google.com/file/d/1X8QkftKxmP62td8qsu5jAzqy0aT2kjys/view?usp=share_link

Image
Louis-Nicolas Leuillet
Le 10/12/2022 à 10:40

J'ai bien regardé votre fichier, voici mon fichier composer :

{
  "name": "react-formation-ultime",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/user-event": "^12.7.1",
    "axios": "^0.21.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.2",
    "styled-components": "^5.2.1",
    "web-vitals": "^1.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Nous n'utilisons pas la même version de react : je vous propose de taper npm install react@17.0.1

Image
Inscrivez-vous ou connectez-vous pour participer à la discussion.

Informations

Créée le 7 décembre 2022 14:04
Dernière activité le 7 décembre 2022 14:04