LarsGIF's avatar

npm run dev: Module build failed, TypeError

I have created a new project and added fortify, jetstream and livewire. When I ran the final "npn run dev" I got the following error:

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 (C:\Users\Lars\Pegasos\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:119:10) at C:\Users\Lars\Pegasos\node_modules\webpack\lib\javascript\CommonJsChunkFormatPlugin.js:30:19 at Hook.eval [as call] (eval at create (C:\Users\Lars\pegasos\node_modules\tapable\lib\HookCodeFactory.js:19:10), :7:1) at Hook.CALL_DELEGATE [as _call] (C:\Users\Lars\pegasos\node_modules\tapable\lib\Hook.js:14:14) at Compiler.newCompilation (C:\Users\Lars\pegasos\node_modules\webpack\lib\Compiler.js:990:30) at C:\Users\Lars\pegasos\node_modules\webpack\lib\Compiler.js:1033:29 at Hook.eval [as callAsync] (eval at create (C:\Users\Lars\pegasos\node_modules\tapable\lib\HookCodeFactory.js:33:10), :15:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\Lars\pegasos\node_modules\tapable\lib\Hook.js:18:14) at Compiler.compile (C:\Users\Lars\pegasos\node_modules\webpack\lib\Compiler.js:1028:28) at Compiler.runAsChild (C:\Users\Lars\pegasos\node_modules\webpack\lib\Compiler.js:495:8)

This was my third try. The first try actually worked in this respekt but had an other problem so I decided to try to start from scrach. The second try ended up like the third.

What could be the problem?

0 likes
10 replies
kinger251285's avatar

Im having the same issue with a brand new install of Laravel 8

1 like
VinayPrajapati's avatar

please try this

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
1 like
LarsGIF's avatar

Thanks Vinay.

Unfortunately it did't help.

I got the following errors:

S C:\Users\Lars\Pegasos> rm -rf node_modules Remove-Item : A parameter cannot be found that matches parameter name 'rf'. At line:1 char:4

+ CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

PS C:\Users\Lars\Pegasos> rm package-lock.json yarn.lock Remove-Item : A positional parameter cannot be found that accepts argument 'yarn.lock'. At line:1 char:1

  • rm package-lock.json yarn.lock
  •   + CategoryInfo          : InvalidArgument: (:) [Remove-Item], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
    
    

PS C:\Users\Lars\Pegasos> npm cache clear --force npm WARN using --force I sure hope you know what you are doing.

npm install (worked OK)

but npm run dev

still generates the same error.

LarsGIF's avatar

Here is the content of the package.json

{ "private": true,

"scripts": {
    "dev": "npm run development",
    "development": "mix",
    "watch": "mix watch",
    "watch-poll": "mix watch -- --watch-options-poll=1000",
    "hot": "mix watch --hot",
    "prod": "npm run production",
    "production": "mix --production"
},
"devDependencies": {
    "@tailwindcss/forms": "^0.2.1",
    "@tailwindcss/typography": "^0.3.0",
    "alpinejs": "^2.7.3",
    "autoprefixer": "^10.0.2",
    "axios": "^0.21",
    "laravel-mix": "^6.0.6",
    "lodash": "^4.17.19",
    "postcss": "^8.1.14",
    "postcss-import": "^12.0.1",
    "tailwindcss": "^2.0.1"
}

}

thinkverse's avatar
Level 15

Update your postcss-import, v12 uses postcss 7, you're using postcss 8, postcss-import ^13.0.0 should work, not sure it'll fix the current issue but it'll fix dependency error's later.

LarsGIF's avatar

Thanks for the advise.

Unfortunately I am very new to this so I need some advice on how to do this.

I have tried to run "composer update postcss-import" but it says there is nothing to update.

Do I need to add a parameter or change some file? Shouldn't these dependances be set correctly during installation?

mustafaxpp's avatar

hello, can you help me solve this problem?

21 error code ELIFECYCLE 22 error syscall spawn bash 23 error file bash 24 error path bash 25 error errno -4058 26 error @ dev: npm run development 26 error spawn bash ENOENT 27 error Failed at the @ dev script. 27 error This is probably not a problem with npm. There is likely additional logging output above

Please or to participate in this conversation.