私は私の最初のTwitterボットを作成しようとしてきたが、私は、NPMの実行DEVを実行したときに、私はこのエラーを取得:なぜノードが私にこのエラーを出すのですか?
> [email protected] dev /mnt/c/Users/rfasc/Dropbox/Hackathon/HackCuTwitter
> node app.js
npm ERR! weird error 1
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
は私のコードを接続するためにnodejsとNPMのcommmandsの使用にやや新しいです。
package.json:
{
"name": "Tweeter",
"version": "1.0.0",
"description": "package.json tester",
"main": "app.js",
"dependencies": {
"twitter": "^1.7.0",
"twitter-stream-api": "^0.5.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node app.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kennychiwa/HackCuTwitter.git"
},
"author": "",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/kennychiwa/HackCuTwitter/issues"
},
"homepage": "https://github.com/kennychiwa/HackCuTwitter#readme"
}
とapp.js:
var twitterpack = require('twitter');
var tokens {
consumer_key: '-------9WJSaaqAe9yVvr30CF',
consumer_secret: '-------------------fj3zoiZ2nUOTBWUjP4DqtGXIlzzbxbOY',
token_key: ' ----------zNHmdL43N6RZJeOtJeH8ZhrursJUQlAqCycHqxbl',
tokenk_secre: '----EcxAjUq1hLka2QYwSSZStETF7Mr2mBikHYCTTqodV'
}
var twitter = new twitterpack(tokens);
Twitter.stream('statuses/filter', {track: 'hey'}, function(stream) {
stream.on('data', function(stream){
console.log(tweet.text);
var meanReply = {status: "hey @" + tweet.user.screen_name}
Twitter.post('statuses/update', meanReply, function(error, tweetReply,
response){
if(error) {console.log(error) /*&&db.collection('errors',
error.text)*/};
console.log(tweetReply.text)}
);
});
stream.on('error', function(error) {
console.log(error);
});
});
助けてください、おかげでここに私のpackage.jsonと私のapp.jsファイルです。
にどのようなあなたのOS(おそらくOS Xの私が見るように)、ノードバージョンを試すことができますか? – h0x91B
Windows 10とバージョン:v0.10.25 @ h0x91B –
Nodejsは本当に古いです:)現在のバージョンは6.10.2です。あなたのバージョンをアップグレードしようとしました – h0x91B