1

While attempting some tests with @testing-library-react I tried to -unsuccesfully- install msw I noticed these npm WARN:

npm WARN airbnb-prop-types@2.16.0 requires a peer of react@^0.14 || ^15.0.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-react-16@1.15.6 requires a peer of react@^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-react-16@1.15.6 requires a peer of react-dom@^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN react-test-renderer@16.14.0 requires a peer of react@^16.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-adapter-utils@1.14.0 requires a peer of react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.

following to npm ERR!

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\@open-draft\until
npm ERR! dest C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\@open-draft\.until.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\@open-draft\until' -> 'C:\xampp\htdocs\react\React-Laravel\vinos-gdl\node_modules\@open-draft\.until.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.

I don't understand what im getting required a peer of react when my current react and react-dom version is 17.0.2. So I'm not quite sure how to fix those WARN which apparently are not letting me to install related packages.

I've already tried deleting node_modules, package.json.lock, running npm cache clean and npm i with not much luck.

If I npm list I'd get at the end the same:

npm ERR! peer dep missing: react@^16.0.0-0, required by enzyme-adapter-react-16@1.15.6
npm ERR! peer dep missing: react-dom@^16.0.0-0, required by enzyme-adapter-react-16@1.15.6
npm ERR! peer dep missing: react@^16.14.0, required by react-test-renderer@16.14.0
npm ERR! peer dep missing: react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0, required by enzyme-adapter-utils@1.14.0
npm ERR! peer dep missing: react@^0.14 || ^15.0.0 || ^16.0.0-alpha, required by airbnb-prop-types@2.16.0

Package.json:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production",
        "test": "jest --watchAll"
    },
    "devDependencies": {
        "@babel/preset-react": "^7.12.13",
        "@testing-library/jest-dom": "5.11.9",
        "@testing-library/react": "^11.2.5",
        "axios": "^0.21.1",
        "bootstrap": "^4.6.0",
        "jquery": "^3.2",
        "laravel-mix": "^6.0.13",
        "lodash": "^4.17.21",
        "popper.js": "^1.16.1",
        "postcss": "^8.2.8",
        "react": "^17.0.2",
        "react-dom": "^17.0.2",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.32.8",
        "sass-loader": "^8.0.2"
    },
    "dependencies": {
        "@babel/plugin-transform-runtime": "^7.13.10",
        "@fortawesome/fontawesome-svg-core": "^1.2.35",
        "@fortawesome/free-brands-svg-icons": "^5.15.3",
        "@fortawesome/free-solid-svg-icons": "^5.15.3",
        "@fortawesome/react-fontawesome": "^0.1.14",
        "downshift": "^6.1.1",
        "enzyme": "^3.11.0",
        "enzyme-adapter-react-16": "^1.15.6",
        "enzyme-to-json": "^3.6.1",
        "jest": "^26.6.3",
        "react-bootstrap": "^1.5.0",
        "react-multi-carousel": "^2.6.2",
        "react-paginate": "^7.1.2",
        "react-router": "^5.2.0",
        "react-router-dom": "^5.2.0",
        "react-select": "^4.3.0",
        "react-test-renderer": "^17.0.2",
        "react-toastify": "^7.0.3"
    },
    "babel": {
        "presets": [
            "@babel/preset-react",
            "@babel/preset-env"
        ],
        "plugins": [
            "@babel/plugin-transform-react-jsx",
            "@babel/plugin-transform-runtime"
        ]
    }
}
Fer Toasted
  • 1,274
  • 1
  • 11
  • 27

1 Answers1

0

Well, apparently running the last version of react andd react-dom which is atm 17.0.2 was not the best idea. I rolled back to the 16.14.0 and everything is working fine.

I found here (How to fix Npm missing peer dependency) that the ^ is kind of misleading.

ie:

requires a peer of react@^15.0.0 || ^16.0.0

Meaning that it requires >15.0.0 but < 17.0.

Fer Toasted
  • 1,274
  • 1
  • 11
  • 27