npm run build报错

执行npm run build的时候报这个错,怎么解决

G:\>npm run build

> vue-admin-template@3.8.0 build G:\SVN\webTHHL\THHLOA\THHLWebUI
> node build/build.js

/ building for production...Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
(node:13612) UnhandledPromiseRejectionWarning: BrowserslistError: Unknown browser kaios
    at checkName (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\node_modules\browserslist\index.js:132:20)
    at Function.select (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\node_modules\browserslist\index.js:830:18)
    at G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\node_modules\browserslist\index.js:176:33
    at Array.reduce (<anonymous>)
    at resolve (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\node_modules\browserslist\index.js:158:18)
    at browserslist (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\node_modules\browserslist\index.js:278:16)
    at isSupported (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\caniuse-api\dist\index.js:62:37)
    at G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\cssnano\node_modules\postcss-reduce-initial\dist\index.js:40:60
    at initializePlugin (G:\SVN\webTHHL\THHLOA\THHLWebUI\node_modules\cssnano\dist\index.js:31:51)
(node:13612) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13612) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
阅读 12.3k
4 个回答

好像是这里的问题,之前也有遇到过
解决办法:

  • 去node_modules 下,删除caniuse-lite 和browserslist两个文件夹,记住这个文件夹,
  • npm install 重新安装,如果没安装到上面这个文件夹下,就手动复制一份进去。

根据他的提示,执行下这个“npm update caniuse-lite browserslist”?

可以尝试对依赖进行一下全局的更新: npm update

npm uninstall这两个依赖项,再重新install就好了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题