1

We are using react & map api named react-naver-maps we publish server by aws amplify suddenly build was failed

I know the ways to solve this error in local computer npm install --force or npm install --legacy-peer-deps

we don't know how to fix this error in publishing

2022-11-20T10:18:03.662Z [INFO]: # Starting phase: preBuild
                                 # Executing command: npm ci
2022-11-20T10:18:05.256Z [WARNING]: npm WARN ERESOLVE
2022-11-20T10:18:05.256Z [WARNING]: overriding peer dependency
                                    npm
2022-11-20T10:18:05.256Z [WARNING]: WARN While resolving: create-react-context@0.2.3
                                    npm WARN Found: react@17.0.2
                                    npm WARN node_modules/react
2022-11-20T10:18:05.256Z [WARNING]: npm WARN   react@"^17.0.2" from the root project
                                    npm WARN   28 more (@emotion/react, @emotion/styled, @material-ui/core, ...)
                                    npm WARN
                                    npm WARN Could not resolve dependency:
                                    npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context@0.2.3
2022-11-20T10:18:05.257Z [WARNING]: npm WARN node_modules/create-react-context
                                    npm WARN   create-react-context@"^0.2.3" from react-naver-maps@0.0.13
                                    npm WARN   node_modules/react-naver-maps
                                    npm WARN
                                    npm WARN Conflicting peer dependency: react@16.14.0
                                    npm WARN node_modules/react
                                    npm WARN   peer react@"^0.14.0 || ^15.0.0 || ^16.0.0" from create-react-context@0.2.3
                                    npm WARN   node_modules/create-react-context
                                    npm WARN     create-react-context@"^0.2.3" from react-naver-maps@0.0.13
                                    npm WARN     node_modules/react-naver-maps
2022-11-20T10:18:05.748Z [WARNING]: npm
2022-11-20T10:18:05.749Z [WARNING]: ERR! code ERESOLVE
2022-11-20T10:18:05.751Z [WARNING]: npm
2022-11-20T10:18:05.751Z [WARNING]: ERR! ERESOLVE could not resolve
                                    npm ERR!
                                    npm ERR! While resolving: react-naver-maps@0.0.13
                                    npm ERR! Found: react@17.0.2
                                    npm ERR! node_modules/react
                                    npm ERR!   react@"^17.0.2" from the root project
                                    npm ERR!   peer react@">=16.8.0" from @emotion/react@11.9.3
                                    npm ERR!   node_modules/@emotion/react
                                    npm ERR!     @emotion/react@"^11.7.1" from the root project
                                    npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.9.3
                                    npm
2022-11-20T10:18:05.751Z [WARNING]: ERR!     node_modules/@emotion/styled
                                    npm ERR!       @emotion/styled@"^11.6.0" from the root project
                                    npm ERR!       3 more (@mui/material, @mui/styled-engine, @mui/system)
                                    npm ERR!     3 more (@mui/material, @mui/styled-engine, @mui/system)
                                    npm ERR!   27 more (@emotion/styled, @material-ui/core, ...)
                                    npm ERR!
                                    npm ERR! Could not resolve dependency:
                                    npm ERR! peer react@"^0.14.0 || ^15.0.0-0 || ^16.0.0-0" from react-naver-maps@0.0.13
                                    npm ERR! node_modules/react-naver-maps
                                    npm ERR!   react-naver-maps@"0.0.13" from the root project
                                    npm ERR!
                                    npm ERR! Conflicting peer dependency: react@16.14.0
                                    npm ERR! node_modules/react
                                    npm
2022-11-20T10:18:05.752Z [WARNING]: ERR!   peer react@"^0.14.0 || ^15.0.0-0 || ^16.0.0-0" from react-naver-maps@0.0.13
                                    npm ERR!   node_modules/react-naver-maps
                                    npm ERR!     react-naver-maps@"0.0.13" 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 /root/.npm/eresolve-report.txt for a full report.
2022-11-20T10:18:05.752Z [WARNING]: 
2022-11-20T10:18:05.753Z [WARNING]: npm ERR! A complete log of this run can be found in:
                                    npm ERR!     /root/.npm/_logs/2022-11-20T10_18_03_884Z-debug-0.log
2022-11-20T10:18:05.761Z [ERROR]: !!! Build failed
2022-11-20T10:18:05.761Z [ERROR]: !!! Non-Zero Exit Code detected
2022-11-20T10:18:05.761Z [INFO]: # Starting environment caching...
2022-11-20T10:18:05.761Z [INFO]: # Uploading environment cache artifact...
2022-11-20T10:18:05.835Z [INFO]: # Uploaded environment cache artifact
2022-11-20T10:18:05.836Z [INFO]: # Environment caching completed
Terminating logging...

our package.json is this

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@babel/core": "^7.16.0",
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@material-ui/core": "^4.12.4",
    "@mui/icons-material": "^5.2.5",
    "@mui/material": "^5.2.8",
    "@mui/styled-engine-sc": "^5.1.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
    "@svgr/webpack": "^5.5.0",
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "@tinymce/tinymce-react": "^4.2.0",
    "alloyfinger": "^0.1.16",
    "axios": "^0.25.0",
    "babel-jest": "^27.4.2",
    "babel-loader": "^8.2.3",
    "babel-plugin-named-asset-import": "^0.3.8",
    "babel-preset-react-app": "^10.0.1",
    "bfj": "^7.0.2",
    "browserslist": "^4.18.1",
    "camelcase": "^6.2.1",
    "case-sensitive-paths-webpack-plugin": "^2.4.0",
    "css-loader": "^6.5.1",
    "css-minimizer-webpack-plugin": "^3.2.0",
    "dotenv": "^10.0.0",
    "dotenv-expand": "^5.1.0",
    "eslint": "^8.3.0",
    "eslint-config-react-app": "^7.0.0",
    "eslint-webpack-plugin": "^3.1.1",
    "file-loader": "^6.2.0",
    "fs-extra": "^10.1.0",
    "html-webpack-plugin": "^5.5.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^27.4.3",
    "jest-resolve": "^27.4.2",
    "jest-watch-typeahead": "^1.0.0",
    "leaflet": "^1.7.1",
    "markdown": "^0.5.0",
    "mini-css-extract-plugin": "^2.4.5",
    "open-color": "^1.9.1",
    "postcss": "^8.4.4",
    "postcss-flexbugs-fixes": "^5.0.2",
    "postcss-loader": "^6.2.1",
    "postcss-normalize": "^10.0.1",
    "postcss-preset-env": "^7.0.1",
    "prompts": "^2.4.2",
    "react": "^17.0.2",
    "react-app-polyfill": "^3.0.0",
    "react-cookie": "^4.1.1",
    "react-daum-postcode": "^3.1.1",
    "react-dev-utils": "^12.0.0",
    "react-dom": "^17.0.2",
    "react-imageslides": "^3.0.0-beta.2",
    "react-leaflet": "^3.2.4",
    "react-naver-maps": "0.0.13",
    "react-redux": "^8.0.2",
    "react-refresh": "^0.11.0",
    "react-router-dom": "^6.2.1",
    "react-window": "^1.8.6",
    "redux": "^4.2.0",
    "resolve": "^1.20.0",
    "resolve-url-loader": "^4.0.0",
    "sass-loader": "^12.3.0",
    "semver": "^7.3.5",
    "source-map-loader": "^3.0.0",
    "style-loader": "^3.3.1",
    "styled-components": "^5.3.3",
    "tailwindcss": "^3.0.2",
    "terser-webpack-plugin": "^5.2.5",
    "tinymce": "^6.2.0",
    "util": "^0.12.4",
    "utill": "^0.1.3",
    "web-vitals": "^2.1.3",
    "webpack": "^5.64.4",
    "webpack-dev-server": "^4.6.0",
    "webpack-manifest-plugin": "^4.0.2",
    "workbox-webpack-plugin": "^6.4.1"
  },
  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js"
  },
  "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": {
    "html-loader": "^4.1.0",
    "json-loader": "^0.5.7"
  },
  "proxy": "https://accounts.google.com",
  "jest": {
    "roots": [
      "<rootDir>/src"
    ],
    "collectCoverageFrom": [
      "src/**/*.{js,jsx,ts,tsx}",
      "!src/**/*.d.ts"
    ],
    "setupFiles": [
      "react-app-polyfill/jsdom"
    ],
    "setupFilesAfterEnv": [],
    "testMatch": [
      "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
      "<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
    ],
    "testEnvironment": "jsdom",
    "transform": {
      "^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js",
      "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
      "^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
    },
    "transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$",
      "^.+\\.module\\.(css|sass|scss)$"
    ],
    "modulePaths": [],
    "moduleNameMapper": {
      "^react-native$": "react-native-web",
      "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
    },
    "moduleFileExtensions": [
      "web.js",
      "js",
      "web.ts",
      "ts",
      "web.tsx",
      "tsx",
      "json",
      "web.jsx",
      "jsx",
      "node"
    ],
    "watchPlugins": [
      "jest-watch-typeahead/filename",
      "jest-watch-typeahead/testname"
    ],
    "resetMocks": true
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  }
}

or don't use that modules?

YoonDH
  • 11
  • 2

1 Answers1

0

The error indicates a missing peer dependency of react between versions 14-16 so it is likely not compatible with your newer version of react 17. Peer dependencies are dependencies that you must install manually or are typically found in the dependency trees of similar libraries, but are still mandatory for the operation of the library. Your best option is to try a different library.

Kemal Ahmed
  • 638
  • 6
  • 15