有人可以帮我吗,我正在尝试将vue.js与laravel集成,当我尝试npm运行时我遇到了问题

connect@1.0.0 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
      ^



这是我的包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"
  }
}

我运行npm install并安装了所有模块,但是由于某种原因我无法运行npm watch。

最佳答案

尝试重新安装node_modules。可能与已安装的软件包和您的特定操作系统不匹配,或者存在其他问题。

试试这个:

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

资料来源:Laravel Mix npm run dev error #1072

10-05 20:36
查看更多