2
votes

I'm trying to run "npm run dev" in my laravel project but there is an error occured that saying: Error: Cannot find module 'webpack-cli/package.json' Require stack:

  • C:\Users\abdal\AppData\Roaming\npm-cache_npx\20792\node_modules\webpack\bin\webpack.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15) at Function.resolve (internal/modules/cjs/helpers.js:78:19) at runCli (C:\Users\abdal\AppData\Roaming\npm-cache_npx\20792\node_modules\webpack\bin\webpack.js:50:26) at C:\Users\abdal\AppData\Roaming\npm-cache_npx\20792\node_modules\webpack\bin\webpack.js:139:5 at processTicksAndRejections (internal/process/task_queues.js:97:5) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\abdal\AppData\Roaming\npm-cache\_npx\20792\node_modules\webpack\bin\webpack.js' ] }

Note that the webpack cli has been downloaded.

1
did you run "npm install" and what folder are you using in the command line interface ? - Islam ElHakmi
It seems you are missing the webpack-cli module. So first run npm install --save-dev webpack-cli to install webpack-cli and then run npm run dev again. - codedge
@IslamElHakmi I removed node_modules folder from my project and run npm install again and everything is fine now but it said that : run mix again! what does that mean? - Abdallah M Yassin
@codedge I did that before but returns the same result! As I said in the previous comment:I removed node_modules folder from my project and run npm install again and everything is fine now but it said that : run mix again! what does that mean? - Abdallah M Yassin
@AbdallahMYassin try npm run watch if it didn't work try the solution in this issue: github.com/JeffreyWay/laravel-mix/issues/1475 - Islam ElHakmi

1 Answers

0
votes

Try running the following.

npm install -g webpack-cli