• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

解决npm安装vue-router版本过高报错和node Sass 版本过高导致 TypeError: this.getOptions is not a function at Object报错问题

武飞扬头像
weixin_48451408
帮助1

安装vue-router及node Sass版本过高不兼容导致报错

最近在学习vue框架的时候,遇到了几个错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vue_cli_app@0.1.0
npm ERR! Found: less@4.1.2
npm ERR! node_modules/less
npm ERR!   less@"^4.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! node_modules/less-loader
npm ERR!   less-loader@"^5.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See E:\nodeJs\NodeJs\node_cache\eresolve-report.txt for a full report.
学新通

出现此问题的原因是:vue-router的版本太高了
执行该命令即可下载低版本的vue-router:

npm install vue-router@3.1.3 --save-dev --legacy-peer-deps

然后顺带解决我在启动项目的时候报的错误:
TypeError: this.getOptions is not a function at Objec
于是翻阅资料发现是node Sass版本过高于node.js 不兼容的问题
解决方案:
1.首先找到package.json下的 "sass-loader": "^7.3.1"
此处我已经下载好了可兼容的(本来是@9.XX)
学新通
2.然后在终端先卸载旧版本:

npm uninstall node-sass

3.然后安装sass

npm install sass@1.26.5 --save-dev

4.安装@7.3.1版本Sass

npm install sass-loader@7.3.1

5.重新编译安装

npm install

6.运行项目!

npm run dev

即可发现该问题已经解决!

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfgjkj
系列文章
更多 icon
同类精品
更多 icon
继续加载