0
現在、ノード7.6.0を使用していて、npmリクエストモジュール2.80.0を試しています。このモジュールは、package.json npm installによってインストールされます。簡単な例の後、私はただちに「失敗:プロパティのドメインを未定義に設定できません」というメッセージが表示されます。それは、必要な部分を除いてストレートコピーペーストです。ノードリクエストモジュール - サンプル要求が失敗しました
var request = require('../node_modules/request/request');
request('http://www.google.com', function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
私には気づいていないことがありますか?
なぜあなたは '要求'モジュールをそのように 'require()'していますか? – mscdex
^^ええ、彼/彼女は言った。 'require( 'request')のようになります。 –