grunt-autoshot'无法调用方法'createPage'of undefined'

时间:2013-10-10 14:13:02

标签: javascript node.js gruntjs

我想让grunt-autoshot努力截取我的项目的截图,但似乎有一个我找不到的小故障。 我已经以不同的方式重新配置了 grunt.initConfig 命令,似乎无法使其正常工作。这是本地托管的,服务器正常加载,我可以在启用grunt server时看到我的示例文件('index.html')。以下是我现在使用的基于example page

的内容
  

错误:'致命错误:无法调用未定义的方法'createPage'

autoshot: {
        default_options: {
            options: {
                // necessary config
                path: 'screenshots/',
                local: {
                    path: './test',
                    port: 9000,
                    files: [{
                        src: 'index.html',
                        dest: 'index.jpg'
                    }]
                },
                viewport: [
                    '320x480', '480x320', '384x640', '640x384', '602x963', '963x602', '600x960', '960x600', '800x1280', '1280x800', '768x1024', '1024x768'
                ]
            },
        },
    },

2 个答案:

答案 0 :(得分:2)

您需要安装PhantomJS。

如果你在Mac上,你可以这样做:

brew update && brew install phantomjs

否则请访问http://phantomjs.org/download.html

答案 1 :(得分:0)

我和朋友一起工作,我们遇到了同样的问题。

看起来这是因为phantomjs的版本。我使用的是1.9.2,我得到了相同的错误,下载并安装了1.9.0,它可以工作(它对我有用)你可以从这里下载它:https://code.google.com/p/phantomjs/downloads/detail?name=phantomjs-1.9.0-macosx.zip&can=1&q=

相关问题