如何在Grunt中使用stylelint?

时间:2015-07-30 15:21:30

标签: javascript css node.js gruntjs stylelint

我正在尝试用grunt-scss-lint替换stylelint(因为它没有安装gem时会出现Ruby依赖和静默失败)。

我遇到的问题是以下错误:

$ grunt                                                                        
Loading "Gruntfile.js" tasks...ERROR
>> ReferenceError: Map is not defined

我认为这是因为stylelint(这是一个PostCSS插件,而不是Grunt插件)需要ES6。

Here's the code that's throwing the Map is not defined error.

有没有什么方法可以让我在grunt运行/cabinet/而不是一些奇怪的解决方法like this

1 个答案:

答案 0 :(得分:6)

看起来您只需要升级您的Node版本。如果你运行0.12或更高,你应该没有Map的麻烦。 (0.12 +中不需要--harmony标志使得“奇怪的解决方法”变得怪异。)

Node安装独立于Grunt。运行node -v以查看其中的内容。如果您需要升级,只需使用nodejs.org获取最新版本。