一直使用的是Koala工具做sass的编译,最近突然发现了一个奇怪的BUG,明明有文件,却始终显示null;而且工具内的项目都无法删除。报错如下:

TypeError: Cannot read property '...css/_style.scss' of null
    at /Applications/Koala.app/Contents/Resources/app.nw/app/scripts/fileWatcher.js:133:30
    at Array.forEach (native)
    at Object.exports.addImports (/Applications/Koala.app/Contents/Resources/app.nw/app/scripts/fileWatcher.js:132:13)
    at getOrWatchStyleImports (/Applications/Koala.app/Contents/Resources/app.nw/app/scripts/compilers/common.js:63:21)
    at Object.exports.watchImports (/Applications/Koala.app/Contents/Resources/app.nw/app/scripts/compilers/common.js:79:5)
    at /Applications/Koala.app/Contents/Resources/app.nw/app/scripts/compilers/SassCompiler.js:160:20
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)

最终在反复确认文件无错的情况下,怀疑是Koala自己的配置文件出问题,最终解决办法如下:

  • 退出Koala工具
  • 找到配置文件:~/Library/Application Support/Koala/UserData/imports.json
  • 删除之
  • 打开Koala

以上。