Knowledge Map

grunt 에러 Fatal error: Cannot read property 'contents' of undefined 본문

WEB

grunt 에러 Fatal error: Cannot read property 'contents' of undefined

2016. 11. 19. 21:15

책 '프론트 엔드 자동화 시스템 그런트' 의 예제를 해보고 있었다.


예제 세팅을 하고 마지막으로 grunt serve를 통해서 웹서버를 실행시킬려고 했더니 다음과 같은 에러가 발생했다.

Fatal error: Cannot read property 'contents' of undefined

물론 grunt serve --force를 하게 되면 그냥 넘어가기는 하지만 일단 문제가 생긴 것을 해결해야 하지 않을까 싶어서 해결책을 찾아 보았다.

관련 에러는 이미 이슈로 되어 있었는데 https://github.com/gruntjs/grunt-contrib-imagemin/issues/208 이곳을 참고하면 된다.


해결책은 pakage.json 을 열어서 grunt-contrib-imagemin를 찾은 다음에 "^1.0.0"  으로 변경하면 된다. 
즉   "grunt-contrib-imagemin": "^1.0.0"  이렇게 하면 된다.


깔끔하게 진행하려고 node-module를 삭제한 상태에서 저것을 수정하고 다시 npm install, grunt를 실행했다.

Comments