webpack: TypeError: dep.getResourceIdentifier is not a function

What is the current behavior? Trying to mix under laravel 5.6.7 using laravel-mix 2.0.0 & webpack 4.1.0 npm run dev

getting this error on every run… tried common work around, deleted npm_modules folder npm cache clean --force npm install still the same…

cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

0% compiling 10% building modules 0/1 modules 1 active …krish\node_modules\toastr\toastr.less 10% building modules 1/1 modules 0 active 10% building modules 2/2 modules 0 active 10% building modules 2/3 modules 1 active …\www\krish\resources\assets\js\app.js 10% building modules 2/5 modules 3 active …\krish\resources\assets\sass\app.scss 10% building modules 3/6 modules 3 active …sources\assets\less\adminlte-app.less 10% building modules 4/7 modules 3 active …krish\node_modules\toastr\toastr.less 10% building modules 5/8 modules 3 active …otstrap-less\bootstrap\bootstrap.less 10% building modules 6/8 modules 2 active …sh\resources\assets\js\app-landing.js 10% building modules 6/9 modules 3 active …krish\node_modules\toastr\toastr.less 10% building modules 6/11 modules 5 active …\krish\resources\assets\sass\app.scss 10% building modules 6/12 modules 6 active …sources\assets\less\adminlte-app.less 10% building modules 6/13 modules 7 active …modules\style-loader\lib\addStyles.js 10% building modules 7/13 modules 6 active …modules\style-loader\lib\addStyles.js 10% building modules 8/13 modules 5 active …sources\assets\less\adminlte-app.less 10% building modules 8/14 modules 6 active …de_modules\css-loader\lib\css-base.js 11% building modules 9/14 modules 5 active …de_modules\css-loader\lib\css-base.js 11% building modules 10/14 modules 4 active …de_modules\css-loader\lib\css-base.js 11% building modules 11/14 modules 3 active …sources\assets\less\adminlte-app.less 11% building modules 11/15 modules 4 active …node_modules\style-loader\lib\urls.js 11% building modules 11/16 modules 5 active …h\node_modules\vue\dist\vue.common.js 11% building modules 12/16 modules 4 active …h\node_modules\vue\dist\vue.common.js 11% building modules 13/16 modules 3 active …h\node_modules\vue\dist\vue.common.js 11% building modules 14/16 modules 2 active …sources\assets\less\adminlte-app.lessTypeError: dep.getResourceIdentifier is not a function

at addDependency (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:387:30)
at iterationOfArrayCallback (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:78:3)
at addDependenciesBlock (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:407:5)
at Compilation.processModuleDependencies (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:418:4)
at afterBuild (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:545:16)
at _this.buildModule.err (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:591:11)
at callback (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:342:35)
at module.build.error (C:\wamp\www\krish\node_modules\webpack\lib\Compilation.js:378:12)
at handleParseResult (C:\wamp\www\krish\node_modules\webpack\lib\NormalModule.js:363:12)
at doBuild.err (C:\wamp\www\krish\node_modules\webpack\lib\NormalModule.js:385:6)
at runLoaders (C:\wamp\www\krish\node_modules\webpack\lib\NormalModule.js:264:12)
at C:\wamp\www\krish\node_modules\loader-runner\lib\LoaderRunner.js:370:3
at iterateNormalLoaders (C:\wamp\www\krish\node_modules\loader-runner\lib\LoaderRunner.js:211:10)
at Array.<anonymous> (C:\wamp\www\krish\node_modules\loader-runner\lib\LoaderRunner.js:202:4)
at Storage.finished (C:\wamp\www\krish\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:43:16)
at provider (C:\wamp\www\krish\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:79:9)
at C:\wamp\www\krish\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:532:3)

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-03-05T19_05_05_252Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: npm run development npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-03-05T19_05_05_702Z-debug.log

Process finished with exit code 1

Package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "lint": "./node_modules/.bin/eslint --ext .js,.vue resources/assets/js"
  },
  "devDependencies": {
    "acacha-forms": "^1.0.0",
    "admin-lte": "^2.4.2",
    "axios": "^0.18.0",
    "babel-eslint": "^8.2.2",
    "babel-loader": "^7.1.3",
    "babel-preset-es2015": "^6.22.0",
    "bootstrap-less": "^3.3.8",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.1.3",
    "eslint": "^4.18.2",
    "eslint-config-standard": "^11.0.0",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-html": "^4.0.2",
    "eslint-plugin-promise": "^3.6.0",
    "eslint-plugin-standard": "^3.0.0",
    "font-awesome": "^4.7.0",
    "icheck": "^1.0.2",
    "ionicons": "^3.0.0",
    "jquery": "^3.3.1",
    "laravel-mix": "2.*",
    "less": "^3.0.0",
    "less-loader": "^4.0.6",
    "lodash": "^4.17.5",
    "node-sass": "^4.7.2",
    "sass-loader": "^6.0.7",
    "toastr": "^2.1.4",
    "vue": "^2.5.13",
    "vue-loader": "^14.0.0"
  },
  "dependencies": {
    "ajv": "^6.2.1",
    "bootstrap": "^3.3.7",
    "bootstrap-iconpicker": "^1.8.2",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-node": "^6.0.0",
    "jquery-ui": "^1.12.1",
    "jquery-ui-dist": "^1.12.1",
    "jquery-ujs": "^1.2.2",
    "select2": "^4.0.6-rc.1",
    "vue-template-compiler": "^2.5.13",
    "webpack": "^4.1.0",
    "webpack-cli": "^2.0.10"
  },
  "babel": {
    "presets": [
      "es2015"
    ]
  }
}

Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System. Node.js: 9.7.1 npm: 5.7.1 webpack: 4.1.0 OS: Win10 32bit Except bootstrap, all packages are up-to-date.

Ref: There is no html-webpack-plugin as mentioned here…

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 18
  • Comments: 31 (8 by maintainers)

Most upvoted comments

downgrading lol? of course that works. i dont understand this thread at all. the point is to go to webpack 4.

a work around i have found is to run:

  • npm i webpack@3.11.0
  • npm install
  • npm run dev

this worked for me, but of course it is working with the old version 3.11, there is still no fix for ^4 version

Same here. Please let me know how can I help you to reproduce the error.

P.S Switching back to 3.11.0 solves the problem.

@bulgariamitko that’s kind of exactly what everyone above us has said already…

Can confirm that downgrading to 3.11.0 solved it for me too.

I’m coming across this issue now, webpack@4.5.0, laravel-mix@2.1.11.

Commenting out mix.extract, mix.js (anything that generates a js entry point) seems to solve the issues… this is either an issue with laravel-mix’s babel implementation or there’s some kind of conflict in webpack.mix.js files.

Will comment more if I find the source of the issue.

In package.json : “webpack”: “^3.11.0”, It solves the problem, but still having problems with the latest version of Quasar-Framework.

Module not found: Error: Can’t resolve ‘quasar-framework’ Probably i have to downgrade version of quasar, it is embarassing 😃 Or you can change import declaration : import {…}from ‘quasar-framework/dist/quasar.mat.esm’;

For time being downgraded to webpack: 3.11.0 Thanks @programmo & @matrunchyk for the info. And @sokra please refer to this,… TypeError: “x” is not a function. Not sure but, I think there is problem with map function.

@sokra I do think having Webpack installed multiple times is the reason why I’m getting this error. However, I cannot delete the old version in my yarn.lock file. My package.json is up to date so I have tried deleting the yarn.lock and rebuilding it but that didn’t work. I have also tried using yarn remove but I get an error saying that I can’t remove as the module is not in the manifest. I’ve also deleted my node_modules folder and rebuilt that just in case. I cannot seem to remove the old webpack version, is there a specific way I need to do this?

@Dwood15 PR welcome to fix it in mini-css-extract-plugin

We are having the same issue, we have a mono repo using lerna, we can not downgrade the webpack version because we are using the multi entrypoint feature from webpack 4

tools lerna: 3.20.2 webpack: 4.42.0" webpack-cli: ^3.3.10

(node:62360) DeprecationWarning: Tapable.plugin is deprecated. Use new API on.hooks` instead

40% [0] building 1/1 modules 0 activeTypeError: dep.getResourceIdentifier is not a function
    at addDependency (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:796:30)
    at iterationOfArrayCallback (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:208:3)
    at addDependenciesBlock (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:816:5)
    at Compilation.processModuleDependencies (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:827:4)
    at afterBuild (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:1095:13)
    at buildModule.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:1123:8)
    at callback (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:734:5)
    at module.build.error (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compilation.js:782:12)
    at handleParseResult (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/NormalModule.js:478:12)
    at doBuild.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/NormalModule.js:500:6)
    at runLoaders (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/NormalModule.js:358:12)
    at /Users/username/Documents/git/js/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/username/Documents/git/js/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/username/Documents/git/js/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/username/Documents/git/js/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/Users/username/Documents/git/js/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at loader.call.then.args (/Users/username/Documents/git/js/apps/modulo-1/node_modules/babel-loader/lib/index.js:55:71)
55% [0] /Users/username/Documents/git/js/node_modules/neo-async/async.js:16
    throw new Error('Callback was already called.');
    ^

Error: Callback was already called.
    at throwError (/Users/username/Documents/git/js/node_modules/neo-async/async.js:16:11)
    at done (/Users/username/Documents/git/js/node_modules/neo-async/async.js:2920:13)
    at runCompilers (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/MultiCompiler.js:181:48)
    at err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/MultiCompiler.js:188:7)
    at compiler.run (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/MultiCompiler.js:270:7)
    at finalCallback (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:257:39)
    at hooks.done.callAsync.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:306:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/Documents/git/js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/username/Documents/git/js/node_modules/tapable/lib/Hook.js:154:20)
    at emitRecords.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:304:22)
    at Compiler.emitRecords (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:499:39)
    at emitAssets.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:298:10)
    at hooks.afterEmit.callAsync.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:485:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/Documents/git/js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:20:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/username/Documents/git/js/node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEachLimit.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:482:27)
    at /Users/username/Documents/git/js/node_modules/neo-async/async.js:2818:7
    at done (/Users/username/Documents/git/js/node_modules/neo-async/async.js:3522:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/Documents/git/js/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/username/Documents/git/js/node_modules/tapable/lib/Hook.js:154:20)
    at outputFileSystem.writeFile.err (/Users/username/Documents/git/js/apps/modulo-1/node_modules/webpack/lib/Compiler.js:464:33)
    at /Users/username/Documents/git/js/node_modules/graceful-fs/graceful-fs.js:57:14
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)
error Command failed with exit code 1.`

Remove webpack 3.x from package.lock than it works.

laravel-mix installs an outdated version of webpack (3.x). 2! fucking major versions behind. What are these guys doing?

The Dependency base class has a definition of getResourceIdentifier.

https://github.com/webpack/webpack/blob/c61b0fdec11c2192ee96129fb256b74c1cca2583/lib/Dependency.js#L19-L21

If you get this error you either don’t use the Dependency base class (unlikely) or you extend from Dependency in an old webpack dependency (very likely). Check if webpack is installed multiple times. (yarn why webpack npm list webpack)

@bulgariamitko Commenting it out was only for debugging purposes.

Never did find the solution to the bug, I’ve been working on moving my stuff away from Laravel-mix to webpack just because there’s a lot of weirdness with mix that I seem to constantly run into. Would rather work with Webpack’s massive community than edge cases with mix.

If you’re coming across this issue and you’re using laravel-mix, probably a good idea to report the bug on JeffreyWay’s repository until we can find the source.