laravel-mix: Error on npm run dev with Laravel Project

Hi,

I get following error when i am try to run npm run dev command on windows power-shell

@ development C:\Users\Praneeth Gamage\Desktop\Laravel_Projects\posty mix

[webpack-cli] Running multiple commands at the same time is not possible [webpack-cli] Found commands: ‘bundle’, ‘Gamage\Desktop\Laravel_Projects\posty\node_modules\laravel-mix\setup\webpack.config.js’ [webpack-cli] Run ‘webpack --help’ to see available commands and options npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: mix npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Praneeth Gamage\AppData\Roaming\npm-cache_logs\2021-01-10T12_30_36_179Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev: npm run development npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Praneeth Gamage\AppData\Roaming\npm-cache_logs\2021-01-10T12_30_36_230Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 33

Most upvoted comments

I already solved it, in my case, it was the blank spaces in the path to the project

@fikrisuheri verify that this path is complete, if it is cut it is because of the blank spaces, the solution is to move the project from place to a path that does not have spaces. image

npm upgrade is fix my problem. image

you can checkout my youtube channel. https://www.youtube.com/c/EasyITsolutions

npm upgrade works for me 😃

This issue is solved for me.

@drsavant-pub from the code you posted, I see you are using Vue.js. Webpack does not automatically load Vue, so you need to install its loader: https://vue-loader.vuejs.org/

@emineinnovations I’d keep this issue open, as the bug that causes Laravel Mix to fail on Windows when there’s a space in the path is not resolved yet.

The tests run on Node 12, 13, and 14 on Linux and Windows. I’m gonna take a look at this at some point soon. We’re quoting the path to the webpack config file in the CLI to fix this very problem on Windows. It seems like something is causing the quotes to be removed.

### Before

image

### After delete package-lock.json and clear npm cache with npm cache clear --force and delete whole node_modules directory Finally install or update packages again with npm install || npm update You can also add any new packages with npm install <package-name>

This fixed for me. image

Thanks and happy coding.

What commands have to be run in order to make it work? I ran npm upgrade and also npm update and then npm run dev.

🚀❯ npm run dev

> @ dev D:\code\dnw\hannibal\src


> @ development D:\code\dnw\hannibal\src
> mix

Der Befehl "mix" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `mix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alex\AppData\Roaming\npm-cache\_logs\2021-01-11T11_18_48_485Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Alex\AppData\Roaming\npm-cache\_logs\2021-01-11T11_18_48_511Z-debug.log

The content of my 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.2.1",
        "axios": "^0.21",
        "chokidar": "^3.5.0",
        "chokidar-cli": "^2.1.0",
        "cross-env": "^7.0.3",
        "esbuild": "^0.8.31",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.2.4",
        "postcss-custom-properties": "^10.0.0",
        "postcss-import": "^12.0.1",
        "postcss-nested": "^5.0.3",
        "precss": "^4.0.0",
        "tailwindcss": "^2.0.2"
    }
}

Guess I will move it to a different issue as my issue is a little different.