3
votes

can someone help me, i'm trying to integrate vue.js with laravel and i have a problem when im trying to npm run watch it says

[email protected] development C:\xampp\htdocs\connect
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

The system cannot find the path specified. events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules\webpack\bin\webpack.js ENOENT at notFoundError (C:\Users\Areg\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26) at verifyENOENT (C:\Users\Areg\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16) at ChildProcess.cp.emit (C:\Users\Areg\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25) at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) Emitted 'error' event at: at ChildProcess.cp.emit (C:\Users\Areg\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)

at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.j s "--watch"

Here's my 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",
    "babel-core": "^6.26.3",
    "babel-loader": "^8.0.5",
    "babel-preset-env": "^1.7.0",
    "bootstrap": "^4.0.0",
    "jquery": "^3.2",
    "laravel-mix": "^4.0.7",
    "lodash": "^4.17.5",
    "popper.js": "^1.12",
    "resolve-url-loader": "^2.3.1",
    "sass": "^1.15.2",
    "sass-loader": "^7.1.0",
    "vue": "^2.5.22",
    "vue-loader": "^15.6.2",
    "webpack": "^4.29.0"
  },
  "name": "connect",
  "description": "<p align=\"center\"><img src=\"https://laravel.com/assets/img/components/logo-laravel.svg\"></p>",
  "version": "1.0.0",
  "main": "webpack.mix.js",
  "directories": {
    "test": "tests"
  },
  "author": "Areg",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.4"
  }
}

I ran npm install and installed all the modules but for some reason i can't run npm watch.

1

1 Answers

4
votes

Try to re-install the node_modules. Maybe there's some mismatch with the installed packages and your specific OS or some other issue.

Try this:

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

Source: Laravel Mix npm run dev error #1072