【发布时间】:2019-08-19 20:34:46
【问题描述】:
通过 npm 进行 vue-cli 构建时,出现此错误:
Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
这直到最近才有效,我不确定是什么导致它开始失败。似乎是某个时间范围的命中导致它开始报告为“过时”,但我不知道要更新什么来修复它。
我已尝试运行建议的命令,但没有成功。我通过 npm 执行此操作并且没有使用 Visual Studio,因此我没有使用 WebCompiler(并且该目录在我的用户文件夹中不存在),因此 Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist` 中的解决方案不适用。
这也发生在我们通过 VSO 运行的构建系统上,所以它不只是我的盒子。
这是我的 package.json 文件:
{
"name": "productName.portal",
"version": "1.0.0",
"description": "productName.portal static content",
"main": "gulpfile.js",
"keywords": [
"gulp",
"task"
],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/preset-react": "^7.0.0",
"@types/jest": "^23.1.4",
"@types/jquery": "^3.3.4",
"@types/underscore": "^1.8.8",
"@voerro/vue-tagsinput": "^1.8.0",
"@vue/cli-plugin-babel": "^3.0.0-rc.4",
"@vue/cli-plugin-typescript": "^3.0.0-rc.4",
"@vue/cli-plugin-unit-jest": "^3.0.1",
"@vue/cli-service": "3.0.0-rc.4",
"@vue/test-utils": "^1.0.0-beta.20",
"axios": "^0.18.0",
"babel-core": "7.0.0-bridge.0",
"babel-polyfill": "^6.26.0",
"copy-webpack-plugin": "^4.5.2",
"gulp": "^3.9.0",
"gulp-clean-css": "latest",
"gulp-concat": "latest",
"gulp-sourcemaps": "latest",
"gulp-uglify": "latest",
"jquery": "^3.3.1",
"moment": "^2.22.2",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"script-loader": "^0.7.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"ts-jest": "^23.0.0",
"underscore": "^1.9.1",
"vue-i18n": "^8.0.0",
"vue-js-modal": "^1.3.16",
"vue-loading-overlay": "^2.1.0",
"vue-simple-spinner": "^1.2.8",
"vue-template-compiler": "^2.5.16",
"vue-toasted": "^1.1.24",
"vuejs-datepicker": "^1.5.2"
},
"dependencies": {
"node": "^9.9.0",
"typescript": "^3.0.1",
"trie-search": "^1.2.8",
"vue": "^2.5.16",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^7.0.0",
"vuex": "^3.0.1"
},
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"unittest": "vue-cli-service test:unit"
}
}
【问题讨论】:
-
我最终删除了我的 node_modules 文件夹和 package-lock.json 文件并进行了 npm 安装,然后进行了 npm 更新,但由于某种原因,现在没有将 browserlist 模块放入node_modules 文件夹。我做了一个明确的
npm update caniuse-lite browserslist,它强制安装这些节点模块的最新版本,这实际上似乎已经成功了。我在一个新的工作副本上尝试了这个,这似乎是一个可行的解决方案。我认为问题源于以某种方式引用了另一个包,但是通过显式安装它们,它修复了它。 -
@Phil 有一个更好的解决方案 - 如果您找不到罪魁祸首,上面的评论是一种解决方法,但下面的答案实际上似乎是我的问题的解决方案!