Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot find module 'webpack/schemas/WebpackOptions.json'" when trying to install webpack

Tags:

Im trying to install webpack to use in my project, but I get this error and I can't figure out how I could fix it. Any suggestions? I tried intalling webpack, webpack-cli globally and locally too.

module.js:540
throw err;
^

Error: Cannot find module 'webpack/schemas/WebpackOptions.json'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (/Users/macpro/Documents/sites/colo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> 
(/Users/macpro/Documents/sites/colo/node_modules/webpack-cli/bin/config-yargs.js:1:85)
at Module._compile (/Users/macpro/Documents/sites/colo/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
like image 493
el-kitty Avatar asked May 16 '18 15:05

el-kitty


1 Answers

I solved this exact issue by explicitly installing webpack version 4.8.2 locally. Seems like some dependency mapping issues between the latest version of webpack-cli and webpack version 4.8.3

npm install [email protected]
like image 173
DentArthurDent Avatar answered Sep 28 '22 18:09

DentArthurDent