clean-css TypeError无法读取属性' 0'为null

时间:2016-01-05 08:58:36

标签: gulp-uglify gulp-minify-css clean-css gulp-clean-css

我正在尝试缩小我的代码,并且在运行clean-css时我总是会遇到此错误。

/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:66
  return name.replace(/^\-\w+\-/, '').match(/([a-zA-Z]+)/)[0].toLowerCase();
                                                          ^
TypeError: Cannot read property '0' of null
    at findNameRoot (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:66:59)
    at extract (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/extractor.js:36:9)
    at restructure (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/restructure.js:297:22)
    at optimize (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/selectors/advanced.js:71:5)
    at minify (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:228:5)
    at whenSourceMapReady (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:135:7)
    at Object.whenDone (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/clean.js:155:14)
    at processNext (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:105:13)
    at importFrom (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:79:10)
    at ImportInliner.process (/home/k1ngsley/Projects/mobile_rea/partners-mobile-app/node_modules/clean-css/lib/imports/inliner.js:38:10)
Error: Hook failed with error code 8: /home/k1ngsley/Projects/mobile_rea/partners-mobile-app/hooks/after_prepare/070_uglify.js
    at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:195:23
    at _rejected (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:797:24)
    at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:823:30
    at Promise.when (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
    at Promise.promise.promiseDispatch (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:741:41)
    at /home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/home/k1ngsley/npm/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:448:13)

我已经阅读了不同的帖子,上面写着删除注释行等,但所有内容都没有为我解决。

任何人都有任何其他想法或方法来解决这个问题

1 个答案:

答案 0 :(得分:0)

查看速度最快,容错的min.css实用程序。