javascript - grunt-autoshot 'cannot call method ' createPage' of undefined'

标签 javascript node.js gruntjs

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

Error: 'Fatal error: Cannot call method 'createPage' of undefined'

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'
                ]
            },
        },
    },

最佳答案

您需要安装 PhantomJS。

如果您使用的是 Mac,您可以:

brew update && brew install phantomjs

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

关于javascript - grunt-autoshot 'cannot call method ' createPage' of undefined',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19298207/

相关文章:

mysql - 从 Heroku 连接到 AWS MySQL DB 时出现 ETIMEDOUT 错误

javascript - 无法运行 npm 命令 "npm install -g tty.js"。

javascript - 在 Yeoman 中使用 bourbon/bourbon neat 没有错误

javascript - 向按钮发送点击事件时 $apply 已经在进行中?

javascript - react native : How to keep multi-line textinput visible above keyboard

javascript - Morris.js 面积图 - Y 轴上的比例错误(可能是错误?)

javascript - 如何使用 javascript、jquery 或其他一些巧妙的方式提交选择中的下一个选项?

node.js - 存储聊天消息的推荐方法 (node.js)

javascript - Grunt 将外部 JS 编译成内联 HTML

angularjs - 当使用 grunt 构建项目时,Fontawesome 无法工作