【问题标题】:Failed at Laravel Mix scriptLaravel Mix 脚本失败
【发布时间】:2021-06-02 19:10:39
【问题描述】:

我在运行我的任何 Laravel Mix 脚本时遇到此错误。没有错误描述。它只是显示这个。我还尝试删除 node_modules 文件夹,删除 package-lock.json 并运行 npm run cache clean --force 但没有运气

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ota@3.1.0 development: `mix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ota@3.1.0 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!     C:\Users\nabee\AppData\Roaming\npm-cache\_logs\2021-06-02T19_05_57_921Z-debug.log

Process finished with exit code 1

我的package.json 文件是:

{
    "private": true,
    "name": "ota",
    "version": "3.1.0",
    "description": "OTA",
    "author": "mnb",
    "browserslist": [
        "last 2 version",
        "> 2%"
    ],
    "scripts": {
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "production": "mix --production"
    },
    "devDependencies": {
        "@popperjs/core": "^2.9.2",
        "axios": "^0.21",
        "laravel-mix": "^6.0.19",
        "lodash": "^4.17.21",
        "popper.js": "^1.12",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^3.1.0",
        "rtlcss": "^3.2.0",
        "sass": "^1.15.2",
        "sass-loader": "^8.0.0",
        "xxxxx": "^1.0.3"
    },
    "dependencies": {
        "@chenfengyuan/datepicker": "^1.0.9",
        "@curiosityx/bootstrap-session-timeout": "^1.0.0",
        "admin-resources": "git+https://github.com/themesbrand/admin-resources.git#master",
        "apexcharts": "^3.26.3",
        "bootstrap": "^5.0.0-beta2",
        "bootstrap-datepicker": "^1.9.0",
        "bootstrap-editable": "^1.0.1",
        "bootstrap-filestyle2": "^2.1.0",
        "bootstrap-maxlength": "^1.6.0",
        "bootstrap-rating": "0.0.1",
        "bootstrap-timepicker": "^0.5.2",
        "bootstrap-touchspin": "^4.2.5",
        "chance": "^1.1.3",
        "chart.js": "^2.9.4",
        "datatables.net": "^1.10.23",
        "datatables.net-autofill": "^2.3.4",
        "datatables.net-autofill-bs4": "^2.3.4",
        "datatables.net-bs4": "^1.10.20",
        "datatables.net-buttons": "^1.4.2",
        "datatables.net-buttons-bs4": "^1.4.2",
        "datatables.net-keytable": "^2.3.2",
        "datatables.net-keytable-bs4": "^2.3.2",
        "datatables.net-responsive": "^2.2.1",
        "datatables.net-responsive-bs4": "^2.2.1",
        "datatables.net-select": "^1.2.5",
        "datatables.net-select-bs4": "^1.2.5",
        "dragula": "^3.7.2",
        "dropzone": "^5.7.2",
        "echarts": "^4.7.0",
        "flot-charts": "^0.8.3",
        "flot.curvedlines": "^1.1.1",
        "gmaps": "^0.4.24",
        "gulp-rtlcss": "^1.4.1",
        "inputmask": "^4.0.9",
        "ion-rangeslider": "^2.3.0",
        "jquery": "^3.5.1",
        "jquery-countdown": "^2.2.0",
        "jquery-knob": "^1.2.11",
        "jquery-sparkline": "^2.4.0",
        "jquery-steps": "^1.1.0",
        "jquery-validation": "^1.19.3",
        "jquery.easing": "^1.4.1",
        "jquery.flot.tooltip": "^0.9.0",
        "jquery.repeater": "^1.2.1",
        "jszip": "^3.2.2",
        "leaflet": "^1.6.0",
        "magnific-popup": "^1.1.0",
        "masonry-layout": "^4.2.2",
        "metismenu": "^3.0.4",
        "moment": "^2.29.1",
        "node-waves": "^0.7.6",
        "npm-install-peers": "^1.2.2",
        "owl.carousel": "^2.3.4",
        "parsleyjs": "^2.9.1",
        "pdfmake": "^0.1.65",
        "select2": "^4.0.10",
        "simplebar": "^4.2.3",
        "spectrum-colorpicker2": "^2.0.5",
        "sweetalert2": "^10.10.4",
        "table-edits": "^0.0.3",
        "tinymce": "^5.0.16",
        "toastr": "^2.1.4",
        "tui-calendar": "^1.12.5",
        "tui-chart": "^3.8.0",
        "tui-date-picker": "^4.0.2",
        "tui-dom": "^3.0.0",
        "tui-time-picker": "^2.0.2",
        "webpack": "^5.38.1",
        "webpack-rtl-plugin": "^2.0.0"
    }
}

请帮帮我。我花了几个小时试图解决这个问题,但一点运气都没有

【问题讨论】:

  • 你使用的是什么版本的 Laravel Mix?
  • 我正在使用 Laravel Mix v6.0.19
  • 您可以发布您的webpack.mix.js 文件吗?
  • 巨大的东西......首先,你应该只有devDependecies而不是dependencies,其次,请在你的webpack.mix.js中使用模板字符串而不是像"something" + json.value + "/" + string.something这样的连接。 . 利用 JS... 第三,你有很多依赖。

标签: laravel laravel-mix


【解决方案1】:

您有很多过时的软件包。也许尝试升级它们,看看错误是否仍然存在。例如,将您的 package.json 更新为以下内容,然后运行 ​​npm install

{
    "private": true,
    "name": "ota",
    "version": "3.1.0",
    "description": "OTA",
    "author": "mnb",
    "browserslist": [
        "last 2 version",
        "> 2%"
    ],
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@chenfengyuan/datepicker": "^1.0.10",
        "@curiosityx/bootstrap-session-timeout": "^1.0.0",
        "@popperjs/core": "^2.9.2",
        "admin-resources": "git+https://github.com/themesbrand/admin-resources.git#master",
        "apexcharts": "^3.27.2",
        "axios": "^0.21",
        "bootstrap": "^5.0.2",
        "bootstrap-datepicker": "^1.9.0",
        "bootstrap-editable": "^1.0.1",
        "bootstrap-filestyle2": "^2.1.0",
        "bootstrap-maxlength": "^1.10.1",
        "bootstrap-rating": "0.0.1",
        "bootstrap-timepicker": "^0.5.2",
        "bootstrap-touchspin": "^4.3.0",
        "chance": "^1.1.7",
        "chart.js": "^3.4.1",
        "datatables.net": "^1.10.25",
        "datatables.net-autofill": "^2.3.9",
        "datatables.net-autofill-bs4": "^2.3.9",
        "datatables.net-bs4": "^1.10.25",
        "datatables.net-buttons": "^1.7.1",
        "datatables.net-buttons-bs4": "^1.7.1",
        "datatables.net-keytable": "^2.6.2",
        "datatables.net-keytable-bs4": "^2.6.2",
        "datatables.net-responsive": "^2.2.9",
        "datatables.net-responsive-bs4": "^2.2.9",
        "datatables.net-select": "^1.3.3",
        "datatables.net-select-bs4": "^1.3.3",
        "dragula": "^3.7.3",
        "dropzone": "^5.9.2",
        "echarts": "^5.1.2",
        "flot-charts": "^0.8.3",
        "flot.curvedlines": "^1.1.1",
        "gmaps": "^0.4.25",
        "gulp-rtlcss": "^1.4.2",
        "inputmask": "^5.0.6",
        "ion-rangeslider": "^2.3.1",
        "jquery": "^3.6.0",
        "jquery-countdown": "^2.2.0",
        "jquery-knob": "^1.2.11",
        "jquery-sparkline": "^2.4.0",
        "jquery-steps": "^1.1.0",
        "jquery-validation": "^1.19.3",
        "jquery.easing": "^1.4.1",
        "jquery.flot.tooltip": "^0.9.0",
        "jquery.repeater": "^1.2.1",
        "jszip": "^3.6.0",
        "laravel-mix": "^6.0.25",
        "leaflet": "^1.7.1",
        "lodash": "^4.17.21",
        "magnific-popup": "^1.1.0",
        "masonry-layout": "^4.2.2",
        "metismenu": "^3.0.7",
        "moment": "^2.29.1",
        "node-waves": "^0.7.6",
        "npm-install-peers": "^1.2.2",
        "owl.carousel": "^2.3.4",
        "parsleyjs": "^2.9.2",
        "pdfmake": "^0.2.0",
        "popper.js": "^1.12",
        "postcss": "^8.3.5",
        "resolve-url-loader": "^4.0.0",
        "rtlcss": "^3.3.0",
        "sass": "^1.35.2",
        "sass-loader": "^12.1.0",
        "select2": "^4.0.13",
        "simplebar": "^5.3.5",
        "spectrum-colorpicker2": "^2.0.8",
        "sweetalert2": "^11.0.19",
        "table-edits": "^0.0.3",
        "tinymce": "^5.8.2",
        "toastr": "^2.1.4",
        "tui-calendar": "^1.13.1",
        "tui-chart": "^3.11.3",
        "tui-date-picker": "^4.2.2",
        "tui-dom": "^3.0.0",
        "tui-time-picker": "^2.1.2",
        "webpack": "^5.45.1",
        "webpack-rtl-plugin": "^2.0.0",
        "xxxxx": "^1.0.3"
    }
}

【讨论】:

    猜你喜欢
    • 2019-03-06
    • 2019-05-26
    • 1970-01-01
    • 1970-01-01
    • 2019-06-11
    • 2019-03-20
    • 2017-05-01
    • 2016-12-29
    • 1970-01-01
    相关资源
    最近更新 更多