Saturday, 22 April 2017

Why is node giving me this error?

i've been trying to make my first twitter bot, but when I run npm run dev I get this error:

> Tweeter@1.0.0 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 

am somewhat new to using nodejs and the npm commmands to connect my code. Here is my package.json and my app.js file:

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"
}

and 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);
  });
});

please help, thanks.



via Ryan Fasching

No comments:

Post a Comment