运行NPM RUN DEV时未找到vue-loader

bttbmeg0  于 2023-03-24  发布在  Vue.js
关注(0)|答案(1)|浏览(166)

每当我试图运行npm run dev时,它都会给我这个错误,我根本不知道如何修复它。我已经尝试将node js重新安装到最新版本,并通过命令行重新安装所有软件包[webpack-cli]错误:无法找到模块“Uncategorized”

const mix = require('laravel-mix');
const { VueLoaderPlugin } = require('vue-loader');

mix.js('resources/js/app.js', 'public/js')
   .vue()
   .webpackConfig({
      module: {
         rules: [
            {
               test: /\.vue$/,
               loader: 'vue-loader'
            },
            {
               test: /\.js$/,
               exclude: /(node_modules|bower_components)/,
               use: {
                  loader: 'babel-loader',
                  options: {
                     presets: ['@babel/preset-env']
                  }
               }
            },
            {
               test: /\.css$/,
               use: ['style-loader', 'css-loader']
            }
         ]
      },
      plugins: [
         new VueLoaderPlugin()
      ]
   });

对于webpack.mix.js添加了来自GitHub的vue代码。当我谷歌另一个错误时。
Node js package.json文件,其中包含我的VUE所需的所有内容

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --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": "^1.3.4",
    "bootstrap": "^5.2.3",
    "cross-env": "^7.0.3",
    "jquery": "^3.6.4",
    "laravel-mix": "^6.0.49",
    "lodash": "^4.17.21",
    "popper.js": "^1.16.1",
    "resolve-url-loader": "^5.0.0",
    "sass": "^1.59.3",
    "sass-loader": "^13.2.1",
    "vue": "^3.2.47",
    "vue-template-compiler": "^2.7.14",
    "webpack": "^5.76.2",
    "webpack-cli": "^5.0.1"
},
"dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.3.0",
    "@fortawesome/free-solid-svg-icons": "^6.3.0",
    "@fortawesome/vue-fontawesome": "^3.0.3",
    "@trevoreyre/autocomplete-vue": "^2.4.1",
    "bootstrap-select": "^1.13.18",
    "bootstrap-vue": "^2.23.1",
    "broadcast-channel": "^4.20.2",
    "font-awesome": "^4.7.0",
    "laravel-echo": "^1.15.0",
    "moment": "^2.29.4",
    "pusher-js": "^8.0.1",
    "vue-router": "^4.1.6",
    "vue-spinners": "^1.0.2"
}

}

xesrikrc

xesrikrc1#

我认为你缺少vue-loader包..我无法在package.json文件中看到这个。你必须运行这个命令。

npm i vue-loader

安装此软件包。

相关问题