question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: compilation.getCache is not a function

See original GitHub issue

Describe the bug

Followed the default steps for installation. When running npm run start I get following error:

TypeError: compilation.getCache is not a function
    at C:\Users\maarten\Documents\projects\test7\node_modules\copy-webpack-plugin\dist\index.js:459:33
    at SyncHook.eval [as call] (eval at create (C:\Users\maarten\Documents\projects\test7\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:9:1)
    at SyncHook.lazyCompileHook (C:\Users\maarten\Documents\projects\test7\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.newCompilation (C:\Users\maarten\Documents\projects\test7\node_modules\webpack\lib\Compiler.js:630:30)
    at C:\Users\maarten\Documents\projects\test7\node_modules\webpack\lib\Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\maarten\Documents\projects\test7\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\maarten\Documents\projects\test7\node_modules\tapable\lib\Hook.js:154:20)
    at Compiler.compile (C:\Users\maarten\Documents\projects\test7\node_modules\webpack\lib\Compiler.js:662:28)
    at C:\Users\maarten\Documents\projects\test7\node_modules\webpack\lib\Watching.js:77:18
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\maarten\Documents\projects\test7\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:24:1)

package.json

{
  "name": "testseven",
  "private": true,
  "version": "1.0.0",
  "description": "testSeven",
  "repository": "",
  "license": "UNLICENSED",
  "scripts": {
    "start": "npm run dev",
    "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js",
    "build-dev": "cross-env NODE_ENV=development node ./build/build.js",
    "build-prod": "cross-env NODE_ENV=production node ./build/build.js",
    "build-dev-cordova": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova build",
    "build-prod-cordova": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build",
    "build-dev-cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova build ios",
    "build-prod-cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build ios",
    "cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run ios",
    "build-dev-cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova build android",
    "build-prod-cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build android",
    "cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run android",
    "postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/"
  },
  "browserslist": [
    "Android >= 7",
    "IOS >= 11",
    "Safari >= 11",
    "Chrome >= 49",
    "Firefox >= 31",
    "Samsung >= 5"
  ],
  "dependencies": {
    "dom7": "^2.1.5",
    "framework7": "^5.7.14",
    "framework7-icons": "^3.0.1",
    "framework7-svelte": "^5.7.14",
    "svelte": "^3.31.0",
    "template7": "^1.4.2"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-transform-runtime": "^7.12.10",
    "@babel/preset-env": "^7.12.10",
    "@babel/runtime": "^7.12.5",
    "babel-loader": "^8.2.2",
    "chalk": "^4.1.0",
    "copy-webpack-plugin": "^7.0.0",
    "cpy-cli": "^3.1.1",
    "cross-env": "^7.0.3",
    "css-loader": "^5.0.1",
    "file-loader": "^6.2.0",
    "html-webpack-plugin": "^4.5.0",
    "less": "^3.12.2",
    "less-loader": "^7.1.0",
    "mini-css-extract-plugin": "^1.3.3",
    "optimize-css-assets-webpack-plugin": "^5.0.4",
    "ora": "^5.1.0",
    "postcss-loader": "^4.1.0",
    "postcss-preset-env": "^6.7.0",
    "rimraf": "^3.0.2",
    "style-loader": "^2.0.0",
    "svelte-loader": "^2.13.6",
    "terser-webpack-plugin": "^4.2.3",
    "url-loader": "^4.1.1",
    "webpack": "^4.44.2",
    "webpack-cli": "^3.3.12",
    "webpack-dev-server": "^3.11.0"
  }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

66reactions
beebasecommented, Dec 11, 2020

Wow that was fast. Thanks a lot for the link! This indeed fixed it for me:

In my case, So called “copy-webpack-plugin”: “^7.0.0” is causing the error. I degrade to it’s previous version “copy-webpack-plugin”: “^6.3.2” Now everything working fine.

36reactions
bjoernmartincommented, Mar 11, 2021

For those who want to understand why this downgrade is necessary: Version 7 (and by now 8) of copy-webpack-plugin require WebPack 5 to work. So this downgrade is necessary if your project still runs with Webpack 4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: compilation.getCache is not a function #575 - GitHub
i install this plugin with npm in my vue project,and configured in vue.config.js.when i start the project,it told me that 'TypeError: ...
Read more >
copy-webpack-plugin configuration issue - Stack Overflow
An unhandled error has occurred inside Forge: compilation.getCache is not a function TypeError: compilation.getCache is not a function at ...
Read more >
Impossible to compile app.... compilation.getCache is not a ...
hi everybody… since yesterday night impossible to compile project or launch it in browser… i ve created new ... getCache is not a...
Read more >
Framwork7 compilation.getCache is not a function - Mounoy Dev
config.js TypeError: compilation.getCache is not a function at /Users/mounoydev/k/node_modules/copy-webpack-plugin/dist/index.
Read more >
TypeError: compilation.getCache is not a function - CSDN博客
vue 中引入cesium, vue.config.js 中配置cesium参数是报错compilation.getCache is not a functionvue 中引入cesium xu.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found