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
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.
npm upgrade is fix my problem.
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
### After delete
package-lock.jsonand clear npm cache withnpm cache clear --forceand delete whole node_modules directory Finally install or update packages again withnpm install||npm updateYou can also add any new packages withnpm install <package-name>This fixed for me.
Thanks and happy coding.
@wickex Sure…
What commands have to be run in order to make it work? I ran
npm upgradeand alsonpm updateand thennpm run dev.The content of my
package.json:Guess I will move it to a different issue as my issue is a little different.