pnpm: ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies and The command '/bin/sh -c pnpm install' returned a non-zero code: 1

pnpm version: unkown or the latest

Code to reproduce the issue:

we installed the pnpm with dockerfile

dependencies:

  • @element-plus/icons-vue 0.2.7 (1.1.4 is available)
  • axios 0.24.0 (0.27.2 is available)
  • echarts 5.3.2
  • element-plus 2.1.11
  • js-web-screen-shot 1.6.2
  • mitt 3.0.0
  • ol 6.14.1
  • spark-md5 3.0.2
  • vue 3.2.33
  • vue-cache-data 1.5.1
  • vue-router 4.0.15
  • vuex 4.0.2

devDependencies:

  • @babel/core 7.17.10
  • @babel/preset-env 7.17.10
  • @vitejs/plugin-legacy 1.8.2
  • @vitejs/plugin-vue 2.3.2
  • @vue/compiler-sfc 3.2.33
  • @vue/eslint-config-standard 5.1.2 (6.1.0 is available)
  • @vue/test-utils 2.0.0-rc.21
  • @vue/vue3-jest 27.0.0
  • babel-eslint 10.1.0 deprecated
  • babel-jest 27.5.1 (28.0.3 is available)
  • babel-plugin-import 1.13.5
  • eslint 6.8.0 (8.14.0 is available)
  • eslint-plugin-import 2.26.0
  • eslint-plugin-node 11.1.0
  • eslint-plugin-promise 4.3.1 (6.0.0 is available)
  • eslint-plugin-standard 4.1.0 (5.0.0 is available)
  • eslint-plugin-vue 7.20.0 (8.7.1 is available)
  • jest 27.5.1 (28.0.3 is available)
  • jest-transform-stub 2.0.0
  • mockjs 1.1.0
  • regenerator-runtime 0.13.9
  • resize-observer-polyfill 1.5.1
  • sass 1.51.0
  • sass-loader 8.0.2 (12.6.0 is available)
  • unplugin-auto-import 0.6.9 (0.7.1 is available)
  • unplugin-vue-components 0.17.21 (0.19.3 is available)
  • vite 2.9.8
  • vite-plugin-compression 0.5.1
  • vite-plugin-mock 2.9.6
  • vite-plugin-optimize-persist 0.1.2
  • vite-plugin-package-config 0.1.1

ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

. ├─┬ @vue/eslint-config-standard │ └─┬ eslint-import-resolver-webpack │ └── ✕ missing peer webpack@>=1.11.0 ├─┬ sass-loader │ └── ✕ missing peer webpack@“^4.36.0 || ^5.0.0” ├─┬ unplugin-auto-import │ └─┬ unplugin │ ├── ✕ missing peer webpack@“4 || 5” │ └── ✕ missing peer rollup@^2.50.0 ├─┬ unplugin-vue-components │ └─┬ unplugin │ ├── ✕ missing peer webpack@“4 || 5” │ └── ✕ missing peer rollup@^2.50.0 └─┬ vite-plugin-mock └─┬ @rollup/plugin-node-resolve ├── ✕ missing peer rollup@^2.42.0 └─┬ @rollup/pluginutils └── ✕ missing peer rollup@^1.20.0||^2.0.0 Peer dependencies that should be installed: rollup@“>=2.50.0 ❤️.0.0” webpack@“>=4.36.0 <5.0.0 || >=5.0.0 <6.0.0”

The command ‘/bin/sh -c pnpm install’ returned a non-zero code: 1

Expected behavior:

Actual behavior:

Additional information:

dockerfile as follows

FROM node:16-buster-slim

COPY sources.list /etc/apt/

RUN apt-get update

WORKDIR /app COPY package.json /app/package.json RUN npm config set legacy-peer-deps true RUN npm config set registry http://registry.npm.taobao.org RUN npm install -g pnpm RUN pnpm install

package.json as follows

{ “name”: “frontweb”, “version”: “0.1.0”, “private”: true, “scripts”: { “local”: “vite --mode mock”, “serve”: “vite --mode development”, “serve:patheval”: “vite --mode local.patheval”, “serve:pathmedics”: “vite --mode local.pathmedics”, “serve:pathanno”: “vite --mode local.pathanno”, “pathmedics”: “vite --mode pathmedics”, “patheval”: “vite --mode patheval”, “build”: “vite build --mode production”, “build:pathmedics”: “vite build --mode pathmedics”, “build:patheval”: “vite build --mode patheval”, “build:nginx:patheval”: “vite build --mode nginx.patheval”, “jest”: “jest”, “lint”: “vite lint” }, “dependencies”: { “@element-plus/icons-vue”: “^0.2.7”, “axios”: “^0.24.0”, “echarts”: “^5.3.0”, “element-plus”: “^2.0.0”, “js-web-screen-shot”: “^1.6.2”, “mitt”: “^3.0.0”, “ol”: “^6.11.0”, “spark-md5”: “^3.0.2”, “vue”: “^3.2.27”, “vue-cache-data”: “^1.5.1”, “vue-router”: “^4.0.0-0”, “vuex”: “^4.0.2” }, “devDependencies”: { “@babel/core”: “^7.17.7”, “@babel/preset-env”: “^7.16.11”, “@vitejs/plugin-legacy”: “^1.6.4”, “@vitejs/plugin-vue”: “^2.0.1”, “@vue/compiler-sfc”: “^3.0.0”, “@vue/eslint-config-standard”: “^5.1.2”, “@vue/test-utils”: “^2.0.0-rc.18”, “@vue/vue3-jest”: “^27.0.0-alpha.3”, “babel-eslint”: “^10.1.0”, “babel-jest”: “^27.5.1”, “babel-plugin-import”: “^1.13.3”, “eslint”: “^6.7.2”, “eslint-plugin-import”: “^2.20.2”, “eslint-plugin-node”: “^11.1.0”, “eslint-plugin-promise”: “^4.2.1”, “eslint-plugin-standard”: “^4.0.0”, “eslint-plugin-vue”: “^7.0.0”, “jest”: “^27.5.1”, “jest-transform-stub”: “^2.0.0”, “mockjs”: “^1.1.0”, “regenerator-runtime”: “^0.13.9”, “resize-observer-polyfill”: “1.5.1”, “sass”: “^1.26.5”, “sass-loader”: “^8.0.2”, “unplugin-auto-import”: “^0.6.6”, “unplugin-vue-components”: “^0.17.14”, “vite”: “^2.7.2”, “vite-plugin-compression”: “^0.5.1”, “vite-plugin-mock”: “^2.9.6”, “vite-plugin-optimize-persist”: “^0.1.2”, “vite-plugin-package-config”: “^0.1.1” }, “vite”: { “optimizeDeps”: { “include”: [ “@element-plus/icons-vue”, “axios”, “echarts/lib/chart/scatter”, “echarts/lib/component/grid”, “echarts/lib/component/markArea”, “echarts/lib/echarts”, “element-plus”, “element-plus/es”, “element-plus/es/components/breadcrumb-item/style/css”, “element-plus/es/components/breadcrumb/style/css”, “element-plus/es/components/button-group/style/css”, “element-plus/es/components/button/style/css”, “element-plus/es/components/checkbox-group/style/css”, “element-plus/es/components/checkbox/style/css”, “element-plus/es/components/col/style/css”, “element-plus/es/components/date-picker/style/css”, “element-plus/es/components/dialog/style/css”, “element-plus/es/components/dropdown-item/style/css”, “element-plus/es/components/dropdown-menu/style/css”, “element-plus/es/components/dropdown/style/css”, “element-plus/es/components/form-item/style/css”, “element-plus/es/components/form/style/css”, “element-plus/es/components/icon/style/css”, “element-plus/es/components/image/style/css”, “element-plus/es/components/input/style/css”, “element-plus/es/components/loading/style/css”, “element-plus/es/components/message/style/css”, “element-plus/es/components/option/style/css”, “element-plus/es/components/pagination/style/css”, “element-plus/es/components/popover/style/css”, “element-plus/es/components/progress/style/css”, “element-plus/es/components/radio-group/style/css”, “element-plus/es/components/radio/style/css”, “element-plus/es/components/row/style/css”, “element-plus/es/components/scrollbar/style/css”, “element-plus/es/components/select/style/css”, “element-plus/es/components/table-column/style/css”, “element-plus/es/components/table/style/css”, “element-plus/es/components/tooltip/style/css”, “element-plus/es/components/upload/style/css”, “element-plus/lib/locale/lang/zh-cn”, “js-web-screen-shot”, “mitt”, “mockjs”, “ol”, “ol/Feature”, “ol/Map”, “ol/ObjectEventType”, “ol/Observable.js”, “ol/Overlay”, “ol/Overlay.js”, “ol/View”, “ol/control”, “ol/events/condition”, “ol/events/condition.js”, “ol/extent”, “ol/geom”, “ol/geom.js”, “ol/interaction”, “ol/interaction.js”, “ol/interaction/Draw”, “ol/layer”, “ol/layer/Vector”, “ol/source”, “ol/source/Cluster”, “ol/source/Vector”, “ol/source/VectorEventType”, “ol/source/Zoomify”, “ol/sphere.js”, “ol/style.js”, “ol/style/Circle”, “spark-md5”, “vue”, “vue-cache-data”, “vue-router”, “vuex” ] } } }

  • node -v prints: from doker_images node:16-buster-slim
  • Windows, macOS, or Linux?: Linux

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 35 (13 by maintainers)

Commits related to this issue

Most upvoted comments

From what I understand it is highly recommended to resolve them but a project can work just fine with the warnings

Not really. There are two types of peer deps: optional peer dependencies and non-optional ones. The warnings are only printed for non-optional peer dependencies. If a package works without the peer dependencies, then it should be declared as optional peer dependency. Optional peer dependencies are supported by npm/yarn/pnpm for a long time.

Do not ignore these errors. When such issues happen, you should look into it.

i work using vue 3, but the missing peer dependencies need react.

In this case, if you are sure that react is not needed, you can add this to your package.json:

{
  "pnpm": {
    "peerDependencyRules": {
      "ignoreMissing": ["react"]
    }
  }
}

You don’t need to downgrade pnpm. You need to install the missing peer dependencies.

A .npmrc file with strict-peer-dependencies=false is also an option.

@zkochan I wonder though why was this change added to v7.0.0?

strict-peer-dependencies is true by default https://github.com/pnpm/pnpm/pull/4427

From what I understand it is highly recommended to resolve them but a project can work just fine with the warnings, are there any potential issues when setting strict-peer-dependencies to false? And in that case why are the auto-install-peers=false by default?

This is happened after the latest release.

which release can fix this? thanks!

Try pnpm@^6. This solved the issue for me.

I found the answer which works for me.

function readPackage(pkg) {
  pkg.dependencies = {
    ...pkg.peerDependencies,
    ...pkg.dependencies,
  }
  pkg.peerDependencies = {};

  return pkg;
}

module.exports = {
  hooks: {
    readPackage,
  },
};

The origin answer came from https://github.com/pnpm/pnpm/issues/827#issuecomment-927169348

There is the auto-install-peers=true config but it works only when adding new dependencies with peer dependencies.