Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm ERR while resolving cache-loader@4.1.0 #7095

Closed
frankykubo opened this issue Apr 6, 2022 · 10 comments
Closed

npm ERR while resolving cache-loader@4.1.0 #7095

frankykubo opened this issue Apr 6, 2022 · 10 comments
Labels
cannot reproduce We cannot reproduce the problem with the given information. More env information needed.

Comments

@frankykubo
Copy link

Version

5.0.4

Reproduction link

github.com

Environment info

System:
    OS: Windows 10 10.0.19043
    CPU: (6) x64 Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 8.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.29)
  npmPackages:
    @ant-design-vue/babel-helper-vue-transform-on:  undefined (1.0.1)
    @fortawesome/vue-fontawesome: ^3.0.0-5 => 3.0.0-5
    @intlify/vue-devtools:  9.1.9
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1 (1.0.0)
    @vue/babel-helper-vue-transform-on:  1.0.2
    @vue/babel-plugin-jsx:  1.1.1
    @vue/babel-plugin-transform-vue-jsx:  1.2.1 (1.1.2)
    @vue/babel-preset-app:  5.0.4 (4.5.4)
    @vue/babel-preset-jsx:  1.2.4 (1.1.2)
    @vue/babel-sugar-composition-api-inject-h:  1.2.1
    @vue/babel-sugar-composition-api-render-instance:  1.2.4
    @vue/babel-sugar-functional-vue:  1.2.2 (1.1.2)
    @vue/babel-sugar-inject-h:  1.2.2 (1.1.2)
    @vue/babel-sugar-v-model:  1.2.3 (1.1.2)
    @vue/babel-sugar-v-on:  1.2.3 (1.1.2)
    @vue/cli-overlay:  5.0.4 (4.5.4)
    @vue/cli-plugin-babel: ^5.0.4 => 5.0.4 (4.5.4)
    @vue/cli-plugin-eslint: ^5.0.4 => 5.0.4
    @vue/cli-plugin-router: ^5.0.4 => 5.0.4 (4.5.4)
    @vue/cli-plugin-typescript: ^5.0.4 => 5.0.4
    @vue/cli-plugin-vuex:  5.0.4 (4.5.4)
    @vue/cli-service: ^5.0.4 => 5.0.4 (4.5.4)
    @vue/cli-shared-utils:  5.0.4 (4.5.4)
    @vue/compiler-core:  3.2.31 (3.0.0-rc.7)
    @vue/compiler-dom:  3.2.31 (3.0.0-rc.7)
    @vue/compiler-sfc:  3.2.31 (3.0.0-rc.7)
    @vue/compiler-ssr:  3.2.31 (3.0.0-rc.7)
    @vue/component-compiler-utils:  3.3.0 (3.2.0)
    @vue/devtools-api:  6.1.4
    @vue/eslint-config-standard: ^6.1.0 => 6.1.0
    @vue/eslint-config-typescript: ^10.0.0 => 10.0.0
    @vue/preload-webpack-plugin:  undefined (1.1.2)
    @vue/reactivity:  3.2.31 (3.0.0-rc.7)
    @vue/reactivity-transform:  3.2.31
    @vue/runtime-core:  3.2.31 (3.0.0-rc.7)
    @vue/runtime-dom:  3.2.31 (3.0.0-rc.7)
    @vue/server-renderer:  3.2.31
    @vue/shared:  3.2.31 (3.0.0-rc.7)
    @vue/web-component-wrapper:  1.3.0 (1.2.0)
    eslint-plugin-vue: ^8.6.0 => 8.6.0
    typescript: 4.5.5 => 4.5.5
    vue: ^3.2.31 => 3.2.31 (3.0.0-rc.7)
    vue-awesome-example:  2.0.0
    vue-demi:  undefined (0.12.5)
    vue-eslint-parser:  8.3.0
    vue-hot-reload-api:  2.3.4
    vue-i18n: ^9.1.9 => 9.1.9
    vue-loader:  17.0.0 (15.9.8, 16.0.0-beta.5, 15.9.3)
    vue-router: ^4.0.14 => 4.0.14
    vue-style-loader:  4.1.3 (4.1.2)
    vue-svg-loader: ^0.17.0-beta.2 => 0.17.0-beta.2
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  1. Clone from provided repository
  2. run npm install
  3. when its successfull, try to run npm install again
  4. Error should show up in console

What is expected?

Successful npm install

What is actually happening?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: cache-loader@4.1.0
npm ERR! Found: webpack@5.67.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1
npm ERR!   node_modules/@soda/friendly-errors-webpack-plugin
npm ERR!     @soda/friendly-errors-webpack-plugin@"^1.8.0" from @vue/cli-service@5.0.4
npm ERR!     node_modules/@vue/cli-service
npm ERR!       dev @vue/cli-service@"^5.0.4" from the root project
npm ERR!       5 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!   webpack@"^5.54.0" from @vue/cli-plugin-babel@5.0.4
npm ERR!   node_modules/@vue/cli-plugin-babel
npm ERR!     dev @vue/cli-plugin-babel@"^5.0.4" from the root project
npm ERR!   21 more (@vue/cli-plugin-eslint, @vue/cli-plugin-typescript, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from cache-loader@4.1.0
npm ERR! node_modules/cache-loader
npm ERR!   peerOptional cache-loader@"^4.1.0" from @vue/cli-plugin-typescript@5.0.4
npm ERR!   node_modules/@vue/cli-plugin-typescript
npm ERR!     dev @vue/cli-plugin-typescript@"^5.0.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from cache-loader@4.1.0
npm ERR!   node_modules/cache-loader
npm ERR!     peerOptional cache-loader@"^4.1.0" from @vue/cli-plugin-typescript@5.0.4
npm ERR!     node_modules/@vue/cli-plugin-typescript
npm ERR!       dev @vue/cli-plugin-typescript@"^5.0.4" 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.
@kingyue737
Copy link

kingyue737 commented May 5, 2022

Same error for me. cache-loader is deprecated and should be replaced by built-in cache feature of webpack5

#6904 #6634 #6350

@aethr
Copy link

aethr commented Jun 8, 2022

This has started causing issues for us with the new node version v16.15.1 which bundles npm v8.11.0 which has stricter peer dependency resolution.

The workaround for us was to downgrade node to v16.15.0 which uses an earlier version of npm. However, it would be great if this could be fixed so we can keep rolling forward with node versions.

@aethr
Copy link

aethr commented Jun 8, 2022

It looks like some work is happening on this in #6323 but there hasn't been any progress for almost a year.

@steven87vt
Copy link

steven87vt commented Jun 18, 2022

@aethr thank you for the work around.

for anyone else suck with this in docker, node version 16.15-apline and its 3.15, 3.16 variants did not work for me, i ended up forcing the container to my local version:

# https://github.com/vuejs/vue-cli/issues/7095
# n wont work without bash, so i went with ubuntu instead & maintained my final image as apline
FROM node:16.15-buster as node-version

RUN npm install -g n && n 16.13.0

@rojadesign
Copy link

In Netlify you can luckily set the node version as an environment variable, which now works with v16.15.0 as a temporary solution. Thank you @aethr.

@haoqunjiang
Copy link
Member

Can't reproduce. cache-loader is listed as an optional peer dependency wherever it appears in this project. I can't find a reason for it to cause npm installation failure.

@haoqunjiang haoqunjiang added the cannot reproduce We cannot reproduce the problem with the given information. More env information needed. label Jun 20, 2022
@haoqunjiang
Copy link
Member

As for @frankykubo's project, I see that your envinfo doesn't match your package-lock.json. There are multiple versions of the same package in your envinfo (e.g. @vue/cli-plugin-babel: ^5.0.4 => 5.0.4 (4.5.4), indicating that v5.0.4 and v4.5.4 co-exist in your project). I guess removing package-lock.json, node_modules and reinstalling the dependencies would help.

@steven87vt
Copy link

steven87vt commented Jun 20, 2022 via email

@steven87vt
Copy link

In my case I eneded up having to down grade from the latest version of TS to get source map outputs again. After which deleting the package-lock.json file solved the issue here.

@EVogel1999
Copy link

So I was running into this issue trying to upgrade from @vue/cli-plugin-typescript 5.0.4 to 5.0.8. I don't know if this will help anyone but I was able to upgrade by upgrading the version in the package.json and then running npm install --legacy-peer-deps.

undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Sep 22, 2022
This commit fixes two issues:
a. Fix `npm install` not working
b. Fix building not working after npm install fix.

npm install fails with dependency resolution issue due to Vue CLI as
following:

```txt
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: cache-loader@4.1.0
...
```txt

As suggested in Vue issues regenerating packages-lock.json solves the
issue, see: vuejs/vue-cli#6793, vuejs/vue-cli#7095.

However with the new package-lock.json a Font Awesome dependency issue
breaks the builds such as the following:

```txt
ERROR in src/presentation/bootstrapping/Modules/IconBootstrapper.ts:17:7
TS2345: Argument of type 'IconDefinition' is not assignable to parameter of type 'IconDefinitionOrPack'.
  Type 'IconDefinition' is not assignable to type 'IconPack'.
    Index signature for type 'string' is missing in type 'IconDefinition'.
    15 |   public bootstrap(vue: VueConstructor): void {
    16 |     library.add(
  > 17 |       faGithub,
```

This is solved by adding a patch in `tsconfig.json`. This issue was
discussed in FortAwesome/Font-Awesome#12575 where the workaround was
recommended.
LarrMarburger pushed a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
This commit fixes two issues:
a. Fix `npm install` not working
b. Fix building not working after npm install fix.

npm install fails with dependency resolution issue due to Vue CLI as
following:

```txt
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: cache-loader@4.1.0
...
```txt

As suggested in Vue issues regenerating packages-lock.json solves the
issue, see: vuejs/vue-cli#6793, vuejs/vue-cli#7095.

However with the new package-lock.json a Font Awesome dependency issue
breaks the builds such as the following:

```txt
ERROR in src/presentation/bootstrapping/Modules/IconBootstrapper.ts:17:7
TS2345: Argument of type 'IconDefinition' is not assignable to parameter of type 'IconDefinitionOrPack'.
  Type 'IconDefinition' is not assignable to type 'IconPack'.
    Index signature for type 'string' is missing in type 'IconDefinition'.
    15 |   public bootstrap(vue: VueConstructor): void {
    16 |     library.add(
  > 17 |       faGithub,
```

This is solved by adding a patch in `tsconfig.json`. This issue was
discussed in FortAwesome/Font-Awesome#12575 where the workaround was
recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce We cannot reproduce the problem with the given information. More env information needed.
Projects
None yet
Development

No branches or pull requests

7 participants