"name": "javascript-development-environment",
"version": "1.0.0",
"description": "CS 235 package.json file for programming projects",
"scripts": {
"prestart": "babel-node buildScripts/startMessage.js",
"redditImgGet": "babel-node buildScripts/srcReddit.js",
"install": "npm install",
"start":"npm-run-all --parallel security-check open:src",
"security-check": "nsp check",
"open:src": "babel-node buildScripts/srcServer.js"
},
This is currently my package.json
. I am trying to call the script which obtains an image from reddit. The inside of srcReddit.js
is shown below:
var snoowrap = require('snoowrap');
console.log("Starting Reddit Image Fetcher");
const otherRequester = new snoowrap({
userAgent: navigator.userAgent,
clientId: 'Cf8kGqDSuT17xw',
clientSecret: 'DDmMslUwMJW1ZM5JTc07zJDpC8k',
username: 'sharan100',
password: 'Magewindu100'
});
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
r.getHot().map(post => post.title).then(console.log);
console.log("Ending Reddit Image Fetcher");
For this, I am using the wrapper snoowrap for the reddit API. Now when I do a npm start
, I for some reason get this below:
No idea why the console.log
messages do not appear. Does anyone know why?
npm start
runs the start
task and it does not refer to the redditImgGet
task at any time, it seems.
I assume you should change your start
task to
npm-run-all --parallel security-check open:src redditImgGet
Or just run the task directly
npm run redditImgGet
Otherwise, I don't see where you could expect the srcReddit
file to log anything.