neerajgoswami's avatar

Getting this error while running "npm run dev" on new project


> dev
> npm run development


> development
> mix

ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
TypeError: The 'compilation' argument must be an instance of Compilation
    at getCompilationHooks (D:\laravel\JetStream\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:119:10)
    at D:\laravel\JetStream\node_modules\webpack\lib\javascript\CommonJsChunkFormatPlugin.js:30:19
    at Hook.eval [as call] (eval at create (D:\Laravel\JetStream\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (D:\Laravel\JetStream\node_modules\tapable\lib\Hook.js:14:14)
    at Compiler.newCompilation (D:\Laravel\JetStream\node_modules\webpack\lib\Compiler.js:992:30)
    at D:\Laravel\JetStream\node_modules\webpack\lib\Compiler.js:1035:29
    at Hook.eval [as callAsync] (eval at create (D:\Laravel\JetStream\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\Laravel\JetStream\node_modules\tapable\lib\Hook.js:18:14)
    at Compiler.compile (D:\Laravel\JetStream\node_modules\webpack\lib\Compiler.js:1030:28)
    at Compiler.runAsChild (D:\Laravel\JetStream\node_modules\webpack\lib\Compiler.js:497:8)

webpack compiled with 1 error
npm ERR! code 1
npm ERR! path D:\laravel\JetStream
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c webpack --progress --config=node_modules\laravel-mix\setup\webpack.config.js

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mrnee\AppData\Local\npm-cache\_logs21-01-28T08_43_31_943Z-debug.log
npm ERR! code 1
npm ERR! path D:\laravel\JetStream
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c mix

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mrnee\AppData\Local\npm-cache\_logs21-01-28T08_43_32_012Z-debug.log
npm ERR! code 1
npm ERR! path D:\laravel\JetStream
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run development

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mrnee\AppData\Local\npm-cache\_logs21-01-28T08_43_32_076Z-debug.log
0 likes
5 replies
Lirux's avatar

Please share the file resources/css/app.css with us.

neerajgoswami's avatar
neerajgoswami
OP
Best Answer
Level 4

Hey guys, I just fixed this issue by googling a lot. The actual problem was the folder name, I just updated the folder 'Laravel' to 'laravel', and things started working again. I never faced such issues previously, even on Laravel v8.5.5 things were working perfectly.

sr57's avatar

Hi @neerajgoswami

Thanks to share, effectively in the logs we can see laravel and Laravel !

Close your post by selected your answer as best, it can be useful for others.

NickSmithTech's avatar

To further elaborate for other wary experiencers of this issue, if you have a capital letter anywhere in your path (which shouldn't matter when developing in Windows like I do), it causes the script to fail.

So, specifically, in my case: D:\Dockers\dev\pathtomyapp........ caused the error, but D:\dockers\dev\pathtomyapp works.

In my case, I had to docker compose down, changed the D to a d, then docker compose up and now it compiles when I run npm run watch dev/prod.

Please or to participate in this conversation.