NPM,Laravel:未找到命令MIX

2022-03-26 00:00:00 node.js php laravel-8 webpack laravel-mix

有人知道它抛出以下错误的原因以及如何修复它吗?我还多次尝试使用npm install重新安装所有软件包。在Windows上重新安装NodeJS不起作用;我使用的是Laravel 8.22.0。

完整日志

0 verbose cli [
0 verbose cli   'D:\Programme\NodeJS\node.exe',
0 verbose cli   'D:\Programme\NodeJS\node_modules\npm\bin\npm-cli.js',
0 verbose cli   'run',
0 verbose cli   'development'
0 verbose cli ]
1 info using npm@7.3.0
2 info using node@v15.5.1
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:D:ProgrammeNodeJS
ode_modules
pm
pmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:D:MyPath.npmrc 33,,,,,,,,Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:UsersPrivat.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:UsersPrivatAppDataRoaming
pmetc
pmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 verbose npm-session 8b04ab779a67efab
20 timing npm:load Completed in 18ms
21 timing command:run-script Completed in 23ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> 
(D:ProgrammeNodeJS
ode_modules
pm
ode_modules@npmclipromise-spawnindex.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:376:20)
22 verbose stack     at maybeClose (node:internal/child_process:1063:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose cwd D:MyPath
24 verbose Windows_NT 10.0.19042
25 verbose argv "D:\Programme\NodeJS\node.exe" "D:\Programme\NodeJS\node_modules\npm\bin\npm-cli.js" "run" "development"
26 verbose node v15.5.1
27 verbose npm  v7.3.0
28 error code 1
29 error path D:MyPathIDE
30 error command failed
31 error command C:WINDOWSsystem32cmd.exe /d /s /c mix
32 verbose exit 1

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.1",
        "bootstrap": "^4.0.0",
        "clean-webpack-plugin": "^3.0.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^5.0.5",
        "less": "^3.12.2",
        "less-loader": "^7.0.0",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "7.*",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "bootstrap-vue": "^2.21.2",
        "uglify-js": "^3.10.3"
    }
}

解决方案

我尝试了许多解决方案,但只有这些解决方案对我有效:

首先,更新您的LAVELL-MIX

npm install laravel-mix@latest

然后执行全新的NPM安装:

npm clean-install

这应该可以修复laravel 8混合错误。

相关文章