greenpress / vuex-composition-helpers

A util package to use Vuex with Composition API easily.
https://www.npmjs.com/package/vuex-composition-helpers
MIT License
290 stars 32 forks source link

Peer dependency problem #28

Open maleficca opened 3 years ago

maleficca commented 3 years ago

Hello there. I'm experiencing a problem with a npm WARN like this:

npm WARN vuex-composition-helpers@1.0.21 requires a peer of @vue/composition-api@>= 0.4.0 but none is installed. You must install peer dependencies yourself.

While this is not a problem for a local development, as it only displays a warning, this actually crashes my docker build and application deployment. Is there any fix for this? I do have newest vuex-composition-helpers and @vue/composition-api packages installed as dependencies, so I don't understand where's this warning coming from?

The exact error log from docker looks like this:


npm notice New patch version of npm available! 7.0.2 -> 7.0.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.3>
npm notice Run `npm install -g npm@7.0.3` to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: frontend@0.4.0
npm ERR! Found: @vue/composition-api@1.0.0-beta.18
npm ERR! node_modules/@vue/composition-api
npm ERR!   dev @vue/composition-api@"^1.0.0-beta.18" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @vue/composition-api@">= 0.4.0" from vuex-composition-helpers@1.0.21
npm ERR! node_modules/vuex-composition-helpers
npm ERR!   vuex-composition-helpers@"^1.0.21" 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.```
davidmeirlevy commented 3 years ago

Hi,

Is by any chance, one of them is a dependency and the other is a devDependency?

maleficca commented 3 years ago

No, both of them are dependencies. I also tried moving them both to devDependency, but got the same error.

davidmeirlevy commented 3 years ago

Can you provide us a package json that makes this error?

I'll use it as a test case for a unit test, to make sure it passes your sample after the fix.

maleficca commented 3 years ago

Sure thing, here's the exact package.json file:

    "name": "frontend",
    "version": "0.4.0",
    "private": true,
    "scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "build:dev": "vue-cli-service build --mode development",
        "test:unit:watch": "vue-cli-service test:unit --watch",
        "test:unit": "vue-cli-service test:unit",
        "test:e2e": "cypress open --config baseUrl=http://localhost:8080/",
        "test:e2e:headless": "cypress run --headless --config baseUrl=http://localhost:8080/",
        "lint": "vue-cli-service lint",
        "build-watch": "vue-cli-service build --watch"
    },
    "dependencies": {
        "@babel/core": "^7.12.3",
        "@ckeditor/ckeditor5-basic-styles": "^17.0.0",
        "@ckeditor/ckeditor5-essentials": "^17.0.0",
        "@ckeditor/ckeditor5-list": "^17.0.0",
        "@ckeditor/ckeditor5-vue": "^1.0.3",
        "@fortawesome/fontawesome-pro": "^5.15.1",
        "@fortawesome/fontawesome-svg-core": "^1.2.32",
        "@fortawesome/pro-duotone-svg-icons": "^5.15.1",
        "@fortawesome/pro-light-svg-icons": "^5.15.1",
        "@fortawesome/pro-regular-svg-icons": "^5.15.1",
        "@fortawesome/pro-solid-svg-icons": "^5.15.1",
        "@fortawesome/vue-fontawesome": "^0.1.10",
        "@vue/composition-api": "^1.0.0-beta.18",
        "@zycx/three-legacyjson-loader": "^1.0.0",
        "axios": "^0.19.0",
        "babel-polyfill": "^6.26.0",
        "base64url": "^3.0.1",
        "ckeditor5-build-classic": "^1.0.0",
        "ckeditor5-build-classic-plus": "^13.0.0",
        "core-js": "^3.4.3",
        "es6-promise": "^4.2.8",
        "jquery": "^3.5.1",
        "js-cookie": "^2.2.1",
        "jszip": "^3.5.0",
        "less": "^3.12.2",
        "lodash": "^4.17.19",
        "lottie-vuejs": "0.3.6",
        "readlink": "^2.0.1",
        "registry": "^0.3.0",
        "three": "^0.112.1",
        "three-legacyjsonloader": "^1.0.6",
        "tree-flatter": "^1.0.2",
        "v-clipboard": "^2.2.3",
        "v-tooltip": "^2.0.2",
        "vue": "^2.6.12",
        "vue-3d-model": "^1.3.1",
        "vue-file-agent": "^1.7.3",
        "vue-line-clamp": "^1.3.2",
        "vue-router": "^3.4.7",
        "vuedraggable": "^2.24.2",
        "vuelidate": "^0.7.6",
        "vuetify": "^2.3.15",
        "vuex": "^3.5.1",
        "vuex-composition-helpers": "^1.0.21",
        "vuex-persistedstate": "^2.7.0"
    },
    "devDependencies": {
        "@babel/preset-env": "^7.12.1",
        "@vue/cli-plugin-babel": "^4.5.8",
        "@vue/cli-plugin-eslint": "^4.5.8",
        "@vue/cli-plugin-unit-mocha": "^4.5.8",
        "@vue/cli-service": "^4.5.8",
        "@vue/test-utils": "^1.1.0",
        "babel-eslint": "^10.1.0",
        "chai": "^4.2.0",
        "cypress": "^5.4.0",
        "eslint": "^5.16.0",
        "eslint-plugin-vue": "^5.0.0",
        "less-loader": "^7.0.2",
        "mocha": "^6.2.0",
        "moxios": "^0.4.0",
        "null-loader": "^3.0.0",
        "sass": "^1.27.0",
        "sass-loader": "^8.0.0",
        "sinon": "^8.1.1",
        "vue-cli-plugin-unit-karmajs": "^1.0.1",
        "vue-cli-plugin-vuetify": "^2.0.7",
        "vue-template-compiler": "^2.6.12",
        "vuetify-loader": "^1.6.0"
    },
    "eslintConfig": {
        "root": true,
        "env": {
            "node": true
        },
        "extends": [
            "plugin:vue/essential",
            "eslint:recommended"
        ],
        "rules": {},
        "parserOptions": {
            "parser": "babel-eslint"
        },
        "overrides": [
            {
                "files": [
                    "**/__tests__/*.{j,t}s?(x)",
                    "**/tests/unit/**/*.spec.{j,t}s?(x)"
                ],
                "env": {
                    "jest": true
                }
            },
            {
                "files": [
                    "**/__tests__/*.{j,t}s?(x)",
                    "**/tests/unit/**/*.spec.{j,t}s?(x)"
                ],
                "env": {
                    "mocha": true
                }
            }
        ]
    },
    "browserslist": [
        "> 1%",
        "last 2 versions"
    ]
}
maleficca commented 3 years ago

Hi there! In the end I uninstalled the package, because I just used it in a very part of my code. But interestingly, this dependency problem wasn't the reason why my docker build crashed - it was a problem with node. After downgrading to node:14.13.1-alpine3.12, I was able to successfully build my docker container. Just leaving the info here, if anybody else has a similar problem.