-1

I just clone my project from github, but when I run npm install, an error occurred.

This project runs perfectly on my pc. However, it can't even be initialized on my linux laptop. Any solutions?

Here is the error message,

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@testing-yarnlibrary%2freact - Not found
npm ERR! 404 
npm ERR! 404  '@testing-yarnlibrary/react@^11.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/anthonyzhang/.npm/_logs/2021-08-13T17_45_59_614Z-debug.log

package.json,

{
  "name": "qrcode-ordering",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-yarnlibrary/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "bootstrap": "^5.1.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  "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"
    ]
  },
  "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.15.4",
    "css-loader": "^6.2.0",
    "style-loader": "^3.2.1"
  }
}
AnthonyDev220
  • 669
  • 5
  • 17
  • Read the name of the package it's looking for - that doesn't seem right, check what's in the package and lock files. – jonrsharpe Aug 13 '21 at 18:03
  • @jonrsharpe I noticed that too. This is my dependency in ```package.json```, ``` "@testing-yarnlibrary/react": "^11.1.0" ``` and this is what's in the ```yarn.lock```, ```"@testing-library/react@^11.1.0": version "11.2.7" resolved "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz" integrity sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA== dependencies: "@babel/runtime" "^7.12.5" "@testing-library/dom" "^7.28.1" ``` – AnthonyDev220 Aug 13 '21 at 18:15
  • That's very clearly not the name of an existing package, so why don't you fix it and see if that solves the problem? – jonrsharpe Aug 13 '21 at 18:22
  • Thank you! It is working now I believe. – AnthonyDev220 Aug 13 '21 at 18:25

1 Answers1

0

You misspelled @testing-library/react in your package.json as @testing-yarnlibrary/react

https://yarnpkg.com/package/@testing-library/react

Will Evers
  • 934
  • 9
  • 17
  • I don't have ```package-lock.json``` in my repository. I delete the whole folder, and clone the repository again. This time I run ```yarn install```, and this is what I got, ```yarn install v1.22.5 [1/4] Resolving packages... error An unexpected error occurred: "https://registry.yarnpkg.com/@testing-yarnlibrary%2freact: Not found". info If you think this is a bug, please open a bug report with the information provided in "/home/anthonyzhang/Documents/qrcode-ordering/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.``` – AnthonyDev220 Aug 13 '21 at 18:11
  • can you post your package.json? you may have mis-typed `@testing-yarnlibrary/react` or selected a version that does not exist – Will Evers Aug 13 '21 at 18:14
  • I updated my answer with the correct solution – Will Evers Aug 13 '21 at 18:17
  • sure. I will post it in my edited question above. – AnthonyDev220 Aug 13 '21 at 18:17
  • It shows correctly in my ```package.json```. This is what I have in ```package.json``` ``` "name": "qrcode-ordering", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.11.4", "@testing-yarnlibrary/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "bootstrap": "^5.1.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-icons": "^4.2.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "web-vitals": "^1.0.1" }, ``` – AnthonyDev220 Aug 13 '21 at 18:22
  • 1
    look at my updated answer. "@testing-yarnlibrary/react": "^11.1.0" is not a real dependency and should be "@testing-library/react": "^11.1.0" instead – Will Evers Aug 13 '21 at 18:24