Wesley Willis
Wesley Willis

Reputation: 1

Laravel 8 vue 2 "npm run watch" giving `mix watch` error. Can anyone help please?

node v 14.16.0

npm v 6.14.11

@ watch E:\xampp\htdocs
mix watch

E:\xampp\htdocs\node_modules\webpack\lib\NormalModule.js:181
throw new TypeError(
^ TypeError: The 'compilation' argument must be an instance of Compilation at Function.getCompilationHooks (E:\xampp\htdocs\node_modules\webpack\lib\NormalModule.js:181:10)
at E:\xampp\htdocs\node_modules\vue-loader\lib\plugin-webpack5.js:36:70
at Hook.eval [as call] (eval at create (E:\XAMPP\htdocs\node_modules\tapable\lib\HookCodeFactory.js:19:10), :206:1)
at Hook.CALL_DELEGATE [as _call] (E:\XAMPP\htdocs\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (E:\XAMPP\htdocs\node_modules\webpack\lib\Compiler.js:1017:26)
at E:\XAMPP\htdocs\node_modules\webpack\lib\Compiler.js:1059:29
at Hook.eval [as callAsync] (eval at create (E:\XAMPP\htdocs\node_modules\tapable\lib\HookCodeFactory.js:33:10), :22:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (E:\XAMPP\htdocs\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (E:\XAMPP\htdocs\node_modules\webpack\lib\Compiler.js:1054:28)
at E:\XAMPP\htdocs\node_modules\webpack\lib\Watching.js:134:19
at Hook.eval [as callAsync] (eval at create (E:\XAMPP\htdocs\node_modules\tapable\lib\HookCodeFactory.js:33:10), :22:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (E:\XAMPP\htdocs\node_modules\tapable\lib\Hook.js:18:14)
at run (E:\XAMPP\htdocs\node_modules\webpack\lib\Watching.js:88:33)
at E:\XAMPP\htdocs\node_modules\webpack\lib\Watching.js:83:6 at Compiler.readRecords (E:\XAMPP\htdocs\node_modules\webpack\lib\Compiler.js:894:11)
at run (E:\XAMPP\htdocs\node_modules\webpack\lib\Watching.js:79:26)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: mix watch
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

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": {
        "axios": "^0.21",
        "laravel-mix": "^6.0.18",
        "lodash": "^4.17.19",
        "postcss": "^8.2.12",
        "vue-loader": "^15.9.5",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "vue": "^2.6.12",
        "vue-axios": "^3.2.4",
        "vue-router": "^3.5.1"
    }
}

PS E:\xampp\htdocs> npm install

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

It was working before when I tried

npm cache clean --force

but now giving same error. I also tried

npm install webpack

It updated 1 package but still not working. I'm using win 10 64bit.

Deleted node_modules folder, reinstalled nodejs and npm. Nothing worked.

Don't want to delete package-lock.json. Thanks.

Upvotes: 0

Views: 466

Answers (1)

yahya sghayron
yahya sghayron

Reputation: 27

I was facing this issue and was able to fix it by reinstalling node.js or run the node setup and choose repair, it seems that it's a problem related to npm itself

Upvotes: 1

Related Questions