【问题标题】:Okay to Paste-in Package-Lock.json from 19 Hours Ago to Fix "ValidationError: Progress Plugin Invalid Options" (Vue 3)?可以从 19 小时前粘贴 Package-Lock.json 以修复“ValidationError:Progress Plugin Invalid Options”(Vue 3)吗?
【发布时间】:2021-11-10 22:54:06
【问题描述】:

我正在使用 Vue 3,并且我在 19 小时前将运行良好的项目版本推送到了 GitHub。

大约5个小时后,当我输入npm run serve时出现以下问题,导致出现这些信息:

> zagnetic@0.1.0 serve

> vue-cli-service serve

INFO Starting development server...

然后出现以下错误:

ValidationError: Progress Plugin Invalid Options

options should NOT have additional properties
options should NOT have additional properties
options should NOT have additional properties
options should pass "instanceof" keyword validation
options should match exactly one schema in oneOf

    at validateOptions (/Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack/node_modules/schema-utils/src/validateOptions.js:32:11)
    at new ProgressPlugin (/Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack/lib/ProgressPlugin.js:62:3)
    at new Progress (/Users/mgav/zagnetic_vue/zagnetic/node_modules/progress-webpack-plugin/index.js:25:21)
    at new progressPlugin (/Users/mgav/zagnetic_vue/zagnetic/node_modules/progress-webpack-plugin/index.js:127:10)
    at /Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack-chain/src/Plugin.js:14:18
    at Object.toConfig (/Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack-chain/src/Plugin.js:78:22)
    at /Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack-chain/src/Config.js:129:63
    at Array.map (<anonymous>)
    at module.exports.toConfig (/Users/mgav/zagnetic_vue/zagnetic/node_modules/webpack-chain/src/Config.js:129:40)
    at Service.resolveWebpackConfig (/Users/mgav/zagnetic_vue/zagnetic/node_modules/@vue/cli-service/lib/Service.js:261:34)

由于 Package-Lock.json 在发生错误的那几个小时内有 的变化(但 Package.json 100% 未发生变化),是否可以只粘贴19 小时前的 Package-Lock.json 文件覆盖当前文件,解决问题?

这样做有什么危险吗?

我的工作几乎完全是 CSS,但我在错误发生后做了一些基本的事情,比如 npm cache clean --force 这可能导致了一些 Package-Lock.json 差异。

Package-lock.json 太大而无法发布,但这是我的 package.json(与推送到 GitHub 的工作版本和当前 ( un-pushed) 有错误的版本:

{
  "name": "zagnetic",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.36",
    "@fortawesome/free-brands-svg-icons": "^5.15.4",
    "@fortawesome/free-regular-svg-icons": "^5.15.4",
    "@fortawesome/free-solid-svg-icons": "^5.15.4",
    "@fortawesome/vue-fontawesome": "^3.0.0-4",
    "@headlessui/vue": "^1.4.1",
    "@tailwindcss/forms": "^0.3.3",
    "@tailwindcss/typography": "^0.4.1",
    "@vue/cli": "^5.0.0-beta.3",
    "core-js": "^3.6.5",
    "date-fns": "^2.23.0",
    "firebase": "^8.9.0",
    "tailwindcss": "^2.2.14",
    "vue": "^3.0.0",
    "vue-router": "^4.0.0-0"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^5.0.0-beta.3",
    "@vue/cli-plugin-router": "^5.0.0-beta.3",
    "@vue/cli-service": "^5.0.0-beta.3",
    "@vue/compiler-sfc": "^3.2.11",
    "autoprefixer": "^10.3.4",
    "postcss": "^8.3.6",
    "postcss-cli": "^8.3.1"
  }
}

我已经使用"^5.0.0-beta.3" 快一周了,没有任何问题,所以我认为这不是问题。

非常感谢您的帮助!

【问题讨论】:

    标签: vue.js vuejs3 package-lock.json validationerror


    【解决方案1】:

    在尝试恢复到旧的 package-lock.json 之前,我在终端中运行了 npm update,现在一切正常!

    将此标记为正确答案,即使它解决了根本问题,因为它实际上并没有解决所提出的问题(“可以恢复到 package-lock.json 的早期版本,不会造成伤害?”)。

    【讨论】:

      【解决方案2】:

      我将package.json 中的webpack 版本设置为撰写本文时的最新版本"^5.55.1",它暂时为我解决了这个问题。

      为了安全起见,还升级/更新了 Node 和 npm。

      【讨论】:

        【解决方案3】:

        转到位于 node_modules@vue\cli-service\lib\commands 中的 serve.js 文件并注释/删除以下代码行:

        // if (!process.env.VUE_CLI_TEST && options.devServer.progress !== false) {
            //   // the default progress plugin won't show progress due to infrastructreLogging.level
            //   webpackConfig
            //     .plugin('progress')
            //     .use(require('progress-webpack-plugin'))
            // }
        

        【讨论】:

          猜你喜欢
          • 2019-03-11
          • 2020-01-11
          • 2020-09-24
          • 2021-02-25
          • 2017-09-28
          • 2022-01-12
          • 1970-01-01
          • 2018-08-14
          • 1970-01-01
          相关资源
          最近更新 更多