I'm trying to run npm run dev
on a Laravel project, but I get the following error.
Error: Cannot find module '/home/faramarz/todo/node_modules/laravel-mix/setup/webpack.config.js'
And yes, there is no such file in the node-module/ dir. But I ran npm install
with no problem. I also ran npm i laravel-mix
, but it didn't install it.
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.17",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.2.0",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.5.7"
}
}
I always face this problem running this command. Any help?
npm -v:6.4.1
Delete the node_module/ directory and run the following on the command line.
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
If that doesn't work, try:
npm install webpack --save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With