Skip to content

[BUG] Unable to resolve reference $react #5730

Closed
@Bow2Jesus

Description

@Bow2Jesus

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I am attempting to run npm install to create the node_modules folder with nodes and package-lock.json file from the package.json file. When I run npm install it returns this error message "npm ERR! Unable to resolve reference $react".

Expected Behavior

Since I have react and its version defined in my dependencies, then I expect npm to resolve the reference to react and finish processing my package.json file.

Steps To Reproduce

  1. In this environment: Windows 10
  2. With this config (package.json):
{
  "name": "rover-web-app",
  "version": "0.0.1-SNAPSHOT",
  "dependencies": {
    "@handsontable/react": "^4.0.0",
    "@mui/material": "^5.10.10",
    "@mdi/font": "^4.5.95",
    "@typescript-eslint/eslint-plugin": "^5.40.1",
    "@typescript-eslint/parser": "^5.40.1",
    "@typescript-eslint/visitor-keys": "^5.40.0",
    "acorn": "^8.8.0",
    "ajv": "^8.11.0",
    "ajv-keywords": "^5.1.0",
    "axios": "^1.1.3",
    "axios-mock-adapter": "^1.17.0",
    "bootstrap": "^4.3.1",
    "classnames": "^2.3.2",
    "connected-react-router": "^6.9.3",
    "core-js": "^3.25.5",
    "csv": "^5.1.3",
    "csv-string": "^3.1.6",
    "cypress": "^10.10.0",
    "cypress-localstorage-commands": "^2.2.1",
    "debug": "^4.3.4",
    "ensure-array": "^1.0.0",
    "eslint": "^8.25.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-react-app": "^7.0.1",
    "eslint-webpack-plugin": "^3.2.0",
    "eslint-plugin-jsx-a11y": "^6.6.1",
    "eslint-visitor-keys": "^3.3.0",
    "handsontable": "^8.0.0",
    "history": "^4.10.1",
    "jest": "^24.9.0",
    "jquery": "^1.12.4",
    "jwt-decode": "^3.1.1",
    "match-sorter": "^4.1.0",
    "mdi-react": "^5.6.0",
    "moment": "^2.24.0",
    "node": "^16.13.2",
    "node-sass": "^4.14.1",
    "npm": "^8.19.2",
    "popper.js": "^1.16.1",
    "prop-types": "^15.8.1",
    "rc-checkbox": "^2.3.2",
    "rc-steps": "^3.6.0",
    "react": "^18.2.0",
    "react-app-polyfill": "^1.0.6",
    "react-big-calendar": "^1.5.0",
    "react-bootstrap": "^1.6.6",
    "react-circular-progressbar": "^2.1.0",
    "react-cookies": "^0.1.1",
    "react-data-grid": "^6.1.0",
    "react-datepicker": "^4.8.0",
    "react-dom": "^18.2.0",
    "react-dropzone": "^10.2.2",
    "react-feather": "^1.1.6",
    "react-highlight-words": "^0.18.0",
    "react-infinite-scroll-component": "^4.5.3",
    "react-input-autosize": "^3.0.0",
    "react-new-window": "^0.2.2",
    "react-perfect-scrollbar": "^1.5.8",
    "react-popout": "^3.0.2",
    "react-redux": "^7.2.9",
    "react-router": "^5.3.4",
    "react-router-dom": "^5.3.4",
    "react-scripts": "^3.1.1",
    "react-select": "^5.4.0",
    "react-splitter-layout": "^4.0.0",
    "react-table": "^7.8.0",
    "react-table-6": "^6.11.0",
    "react-test-renderer": "^18.2.0",
    "react-toastify": "^5.5.0",
    "recharts": "^1.8.5",
    "redux": "^4.2.0",
    "redux-mock-store": "^1.5.3",
    "redux-thunk": "^2.3.0",
    "rsuite": "^4.1.5",
    "sass-loader": "^8.0.0",
    "styled-components": "^4.3.2",
    "tsutils": "^3.21.0",
    "typescript": "^4.8.4"
  },
  "optionalDependencies": {
    "fsevents": "^2.3.2"
  },
  "scripts": {
    "start": "set PORT=3456 && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "pre-deploy": "REACT_APP_STAGE=DEV npm run build",
    "test:CI": "CI=true react-scripts test --env=jsdom",
    "server": "node-env-run server --exec nodemon | pino-colada",
    "dev": "run-p server start",
    "eject": "react-scripts eject",
    "coverage": "react-scripts test --env=jsdom --watchAll=false --coverage"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@testing-library/react": "^8.0.1",
    "@testing-library/react-hooks": "^8.0.1",
    "@types/jest": "^24.0.19",
    "body-parser": "^1.19.0",
    "cookie-parser": "^1.4.4",
    "enzyme": "^3.10.0",
    "enzyme-adapter-react-16": "^1.14.0",
    "eslint-config-standard": "^14.1.0",
    "eslint-config-standard-react": "^9.2.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-jest": "^22.19.0",
    "eslint-plugin-node": "^10.0.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-react": "^7.31.10",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-standard": "^4.0.1",
    "express": "^4.17.1",
    "express-pino-logger": "^4.0.0",
    "jest-cli": "^24.9.0",
    "jest-enzyme": "^7.1.1",
    "node-env-run": "^3.0.2",
    "nodemon": "^2.0.1",
    "npm-run-all": "^4.1.5",
    "pino": "^5.13.4",
    "pino-colada": "^1.5.0",
    "react-addons-test-utils": "^15.6.2",
    "react-select-event": "^4.1.2",
    "reactstrap": "^8.0.1",
    "request": "^2.88.0"
  },
  "overrides": {
	"react": "$react",
	"react-dom" : "$react-dom",
	"react-test-renderer" : "$react-test-renderer"
  },
  "proxy": "http://localhost:3001"
}
  1. Run 'npm install'
  2. See error: "npm ERR! Unable to resolve reference $react"

Environment

  • npm: 8.19.2
  • Node.js: 16.18.0
  • OS Name: Windows 10
  • System Model Name: Dell Precision 7560
  • npm config:
    ; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\Users\i338909\AppData\Roaming\npm"

; "user" config from C:\Users\i338909.npmrc

http_proxy = "http://bcproxy.hcscint.net:8080"
https_proxy = "http://bcproxy.hcscint.net:8080"
proxy = "http://bcproxy.hcscint.net:8080/"
registry = "http://nexus.fyiblue.com/repository/npm-all/"
scripts-prepend-node-path = true
strict-ssl = true

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.18.0
; npm local prefix = C:\NMP_TEST\rover-web-app-test
; npm version = 8.19.2
; cwd = C:\NMP_TEST\rover-web-app-test
; HOME = C:\Users\i338909
; Run npm config ls -l to show all defaults.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 0will get attention right awayconfig:overridesIssues dealing with the overrides feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions