Search code examples
travis-cistylelint

Getting stylelint errors in Travis but not locally


I've setup a little repo with my own CSS code style. In this repo I've setup a minimal stylelint config just to check I haven't error about unknow rules, no more supported rules, etc.

When I run my $ npm check locally, it run just fine.

But Travis-ci throw me the following errors:

> alb-stylelintrc@0.2.0 test /home/travis/build/alienlebarge/stylelintrc
> gulp lint:css


/home/travis/build/alienlebarge/stylelintrc/node_modules/stylelint/dist/rules/indentation/index.js:232
var hierarchyMap = new Map();
                       ^
ReferenceError: Map is not defined
    at Object.<anonymous> (/home/travis/build/alienlebarge/stylelintrc/node_modules/stylelint/dist/rules/indentation/index.js:232:24)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/travis/build/alienlebarge/stylelintrc/node_modules/stylelint/dist/rules/index.js:227:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
[37m[40mnpm[0m [0m[31m[40mERR![0m[35m[0m Test failed.  See above for more details.
[0m
travis_time:end:0581a9e8:start=1460117969543196000,finish=1460117970835293872,duration=1292097872
[0K
[31;1mThe command "npm test" exited with 1.[0m

Done. Your build exited with 1.

It seams to be about the indentation

"indentation": [
        4, {
          ignore: ["value", "param"]
        }
    ],

But I can't figure what the problem.

Perhaps somebody can help me.


Solution

  • Map is not defined means that you're running on a version of node incompatible with stylelint. stylelint is tested on Node versions 0.12, 4, and 5 (https://github.com/stylelint/stylelint/blob/master/.travis.yml); so I'm guessing your Travis build is running Node 0.10. If you specify Node versions in your .travis.yml, I think this error will go away.