3

我想让grunt-autoshot为我的项目截屏,但似乎有一个小问题我找不到。我以不同的方式重新配置了grunt.initConfig命令,但似乎无法使其正常工作。这都是本地托管的,服务器正在正确加载,当grunt 服务器打开时我可以看到我的示例文件('index.html')。以下是我现在根据示例页面使用的内容

错误:'致命错误:无法调用未定义的方法'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'
                ]
            },
        },
    },
4

2 回答 2

2

您需要安装 PhantomJS。

如果您在 Mac 上,您可以执行以下操作:

brew update && brew install phantomjs

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

于 2013-10-27T00:40:34.440 回答
0

I was working with a friend and we just run into the same problem.

It looks like it's because of the phantomjs' version. I was using 1.9.2 and I was getting the same error, download and install 1.9.0 and it'll work (it did for me) you can download it from here: https://code.google.com/p/phantomjs/downloads/detail?name=phantomjs-1.9.0-macosx.zip&can=1&q=

于 2013-11-03T05:35:40.257 回答