我想使用 gulp-sitespeedio@0.0.8 来测试我的网站和网页测试。
但是我的控制台出现错误,我不知道为什么。找谁是我的错?
[20:16:26] Starting 'webpagetest:build'...
[20:16:26] Analyze your site’s web performance
info: OS: 'darwin 15.6.0', Node.js: 'v5.1.0', sitespeed.io: '3.5.0', PhantomJS: '1.9.8', java: '1.8.0_31', browsertime: '0.9.4'
info: Using configured web perf budget {"wpt":{"requests":60,"bytesIn":1000000,"SpeedIndex":1000}}
info: Will analyze 2 pages
info: Running WebPageTest http://www.sitespeed.io pollResults=10, timeout=800, firstViewOnly=false, runs=9, private=true, aftRenderingTime=true, location=Dulles:Firefox, connectivity=3G, video=true
info: Running WebPageTest http://www.sitespeed.io/faq/ pollResults=10, timeout=800, firstViewOnly=false, runs=9, private=true, aftRenderingTime=true, location=Dulles:Firefox, connectivity=3G, video=true
error: WebPageTest couldn't fetch info for url http://www.sitespeed.io{ [WPTAPIError: Moved Permanently] name: 'WPTAPIError', code: 301, message: 'Moved Permanently' }
error: Error running WebPageTest: { [WPTAPIError: Moved Permanently] name: 'WPTAPIError', code: 301, message: 'Moved Permanently' }
error: WebPageTest couldn't fetch info for url http://www.sitespeed.io/faq/{ [WPTAPIError: Moved Permanently] name: 'WPTAPIError', code: 301, message: 'Moved Permanently' }
error: Error running WebPageTest: { [WPTAPIError: Moved Permanently] name: 'WPTAPIError', code: 301, message: 'Moved Permanently' }
/Users/.../node_modules/sitespeed.io/lib/util/util.js:279
return pageData.webpagetest.wpt[0].response.data.testUrl;
^
TypeError: Cannot read property 'response' of undefined
at Object.module.exports.getURLFromPageData (/Users/.../node_modules/sitespeed.io/lib/util/util.js:279:43)
at Object.exports.processPage (/Users/.../node_modules/sitespeed.io/lib/collectors/assetsByTiming.js:25:21)
at /Users/.../node_modules/sitespeed.io/lib/collector.js:126:7
at Array.forEach (native)
at Collector.collectPageData (/Users/.../node_modules/sitespeed.io/lib/collector.js:125:19)
at processAnalysisResults (/Users/.../node_modules/sitespeed.io/lib/analyze/analyzer.js:171:14)
at /Users/.../node_modules/sitespeed.io/lib/analyze/analyzer.js:68:7
at /Users/.../node_modules/async/lib/async.js:254:17
at /Users/.../node_modules/async/lib/async.js:157:25
at /Users/.../node_modules/async/lib/async.js:251:21
at Object.queue.drain (/Users/.../node_modules/sitespeed.io/lib/analyze/webpagetest.js:63:11)
at next (/Users/.../node_modules/async/lib/async.js:804:31)
at /Users/.../node_modules/async/lib/async.js:32:16
at /Users/.../node_modules/sitespeed.io/lib/analyze/webpagetest.js:127:14
at WebPageTest.testCallback (/Users/.../node_modules/webpagetest/lib/webpagetest.js:346:14)
at callbackYield (/Users/.../node_modules/webpagetest/lib/webpagetest.js:138:14)
这是我的配置。这正是你的例子。
var gulp = require( "gulp" ),
sitespeedio = require( "gulp-sitespeedio" );
gulp.task( "webpagetest:build", sitespeedio( {
urls: ["http://www.sitespeed.io", "http://www.sitespeed.io/faq/"],
noYslow: true,
wptKey: "SECRET_KEY",
wptHost: "www.webpagetest.org",
no: 9,
wptConfig: {
location: "Dulles:Firefox",
connectivity: "3G",
timeout: 800
},
budget: {
wpt: {
requests: 60,
bytesIn: 1000000,
SpeedIndex: 1000
}
}
} ) );
node-version
: v5.1.0 npm-version: v3.3.12 gulp
-version: CLI v3.9.0 // LOCAL 3.9.1
感谢您的帮助...