通过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"
}
}
答案 0 :(得分:1)
这完全取决于@babel/preset-env
├─┬ @babel/preset-env
│ ├─┬ browserslist
│ │ ├── caniuse-lite
您可以通过更新该软件包来纠正此问题
npm update @babel/preset-env
刚刚意识到Vue使用了更多级别的依赖项
├─┬ @vue/cli-plugin-babel
│ ├─┬ @vue/babel-preset-app
│ │ ├─┬ @babel/preset-env
所以您将要更新@vue/cli-plugin-babel
软件包。