Syntax Error: TypeError: this.getOptions is not a function

简介: Syntax Error: TypeError: this.getOptions is not a function

问题

我使用的 node 版本是 12.13.0

0de007c2cb004a2cad150209d29c6c24.png


vue 项目里使用了 node-sasssass-loader,版本如下

"node-sass": "^7.0.3",
"sass-loader": "^13.0.2",


运行报错

0f0deee469ff4640bbd6bced4106a3d2.png



解决


目前我的解决方式降低两个依赖的版本:

"node-sass": "^5.0.0",
"sass-loader": "^10.0.5",



安装相应版本:

npm i node-sass@5.0.0 sass-loader@10.0.5 -D


安装完成运行之后,就没有报错了


709ac80f4e2f4e9783674532dfae5f6e.png


第一个需要注意的就是 node 跟 node-sass 的版本

具体可以参考:https://github.com/sass/node-sass

以下是 node-sass 支持的最低和最高版本的快速指南:

image.png


第二个就是 sass-loader 跟 node-sass 版本

具体可以参考:https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md

目前我测试的 sass-loader 版本高于 11.0.0 会报错,所以选择了这个版本。


e9db89a1a8694f649c8f8026647362ab.png



另外官网也建议转移到 dart sass:

警告:不推荐使用 LibSass 和 Node Sass。 虽然他们将继续无限期地接收维护版本,但没有计划添加额外的功能或与任何新的 CSS 或 Sass 功能兼容。 仍在使用它的项目应该转移到 Dart Sass。




目录
相关文章
|
6月前
TypeError:Joi.validate is not a function 解决办法
TypeError:Joi.validate is not a function 解决办法
|
10月前
|
JavaScript
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
415 0
|
1月前
|
Go
Error: Package awesomeProject contains more than one main function Consider using File kind instead
Goland编辑器运行时出现“edit configuration”窗口,阻碍代码执行。解决方法:右键点击源文件运行。问题源于Go语言不支持函数重载,同一包内不能有两个同名函数,导致多入口冲突。初学者在main包中使用了多个Go源文件,应改为仅有一个源码文件来避免此问题。
|
7月前
Fatal error: Call to undefined function openssl_pkey_get_private()
Fatal error: Call to undefined function openssl_pkey_get_private()
42 0
|
1月前
|
缓存
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
176 0
|
1月前
|
计算机视觉 Python
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
65 0
|
6月前
|
前端开发 JavaScript
Module build failed: TypeError: this.getResolve is not a function,vue写css时启动出错
Module build failed: TypeError: this.getResolve is not a function,vue写css时启动出错
24 0
|
7月前
Uncaught TypeError: l.push is not a function
Uncaught TypeError: l.push is not a function
|
8月前
|
JavaScript Cloud Native Go
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
Error: Cannot find module ‘webpack/bin/config-yargs‘ at Function.Module._resolveFilename (intern
44 0
|
10月前
|
JavaScript 前端开发
Vue项目部署到服务器时上传报错“Uncaught (in promise) TypeError: s.upload.addEventListener is not a function”
使用vue-admin-element框架进行在本地文件上传以及富文本框中的文件上传是没有问题的,但是在上传部署vue项目到服务器上时,就会报如下图中一个错误。
785 0

热门文章

最新文章