laravel-mix: node_modules/laravel-mix/ folder is missing after npm install

  • Laravel Mix Version: #.#.# (npm list --depth=0)
  • Node Version (node -v): 8.11.2
  • NPM Version (npm -v): 5.6.0
  • OS: virtualbox - ubuntu 18.04 (I’m using XAMPP)

Description:

1

I’m getting the following error message when I try to run: “npm run dev”
Error: Cannot find module ‘/home/sedon/laravel-project/node_modules/laravel-mix/setup/webpack.config.js’ at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at requireConfig (/home/sedon/laravel-project/node_modules/webpack/bin/convert-argv.js:97:18) at /home/sedon/laravel-project/node_modules/webpack/bin/convert-argv.js:104:17 at Array.forEach (<anonymous>) at module.exports (/home/sedon/laravel-project/node_modules/webpack/bin/convert-argv.js:102:15) at yargs.parse (/home/sedon/laravel-project/node_modules/webpack/bin/webpack.js:171:41) at Object.Yargs.self.parse (/home/sedon/laravel-project/node_modules/yargs/yargs.js:533:18) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 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! /home/sedon/.npm/_logs/2018-06-06T14_35_31_310Z-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! /home/sedon/.npm/_logs/2018-06-06T14_35_31_322Z-debug.log

2

I’ve read the description:
Note: You won’t find a webpack.config.js file in your project root. By default, Laravel defers to the config file from this repo. However, should you need to configure it, you may copy the file to your project root, and then update your package.json NPM scripts accordingly: cp node_modules/laravel-mix/setup/webpack.config.js ./

~Unfortunately there is no node_modules/laravel-mix folder I could copy. I also tried to install laravel-mix following the description for a stand alone project:

mkdir my-app && cd my-app npm init -y npm install laravel-mix --save-dev cp -r node_modules/laravel-mix/setup/webpack.mix.js ./

ERROR

npm install laravel-mix --save-dev and npm install (in laravel project using ubuntu-virtualbox-xampp) produce the same error:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pngquant-bin@4.0.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pngquant-bin@4.0.0 postinstall 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! /home/sedon/.npm/_logs/2018-06-06T14_52_30_349Z-debug.log

Steps To Reproduce:

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”: “npm run development – --watch”, “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.18”, “bootstrap”: “^4.0.0”, “popper.js”: “^1.12”, “cross-env”: “^5.1”, “jquery”: “^3.2”, “laravel-mix”: “^2.0”, “lodash”: “^4.17.4”, “vue”: “^2.5.7” } }

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15

Most upvoted comments

Delete node_module directory and run below in command line rm -rf node_modules rm package-lock.json yarn.lock npm cache clear --force npm install

If still not working, try below npm install webpack --save