vue安装了stylus后,重启项目,终端报错 Syntax Error: TypeError: this.getOptions is not a function, 意思是有语法错误。。。

原因
安装stylus报错可能是安装的版本过高,进行降级
解决方案
1.先卸载当前版本
npm uninstall stylus-loader
2.安装低版本
npm i stylus-loader@3.0.2 -S
总结
这里, Syntax Error: TypeError: this.getOptions is not a function 这种语法报错提示,一般都是版本问题
当在Vue项目中安装并尝试使用 stylus 时,可能会遇到 `SyntaxError: TypeError: this.getOptions is not a function` 的错误。这通常由于 stylus-loader 版本过高引起。解决这个问题的方法是降级 stylus-loader 版本。首先,通过 `npm uninstall stylus-loader` 卸载现有版本,然后安装指定低版本,如 `npm install stylus-loader@3.0.2-S`。完成降级后,重新启动项目,错误应该会消失。

被折叠的 条评论
为什么被折叠?



