mattcheah / cover-letter-snippets

Angular/MongoDB/Node.js Express local application for quickly composing a cover letter that discusses each keyword and technology on a job listing.
72 stars 31 forks source link

Connect to JSON file functionality doesn't work #12

Open Amruta-Ranade opened 5 years ago

Amruta-Ranade commented 5 years ago

I tried to use the Connect to JSON file functionality, but on clicking the button, nothing happens. I think this is a recent bug, because I remember being able to use the functionality when I first tried the app back in October.

mattcheah commented 5 years ago

Hi Amruta, Sorry for the late reply. What version of the NPM package do you have installed? I think the latest one is 1.3.0, but it works fine for me.

Are you getting any console errors in the browser or in the terminal when you're running it?

mattcheah commented 5 years ago

@Amruta-Ranade - any luck?

Amruta-Ranade commented 5 years ago

Hi Matt,

Sorry, I completely missed your earlier message. I am traveling this month with sub-par access to the internet. Will be back in the US this weekend. Will try out your suggestion and get back to you. Sorry again!

On Fri, Jan 25, 2019, 5:57 AM Matt Cheah notifications@github.com wrote:

@Amruta-Ranade https://github.com/Amruta-Ranade - any luck?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mattcheah/cover-letter-snippets/issues/12#issuecomment-457409981, or mute the thread https://github.com/notifications/unsubscribe-auth/AK87cjXNFB7ZLWJagO1UoLz4IZqCAPlXks5vGk-DgaJpZM4ZzFA6 .

Amruta-Ranade commented 5 years ago

Hey..I am back at my laptop. I was prompted to upgrade npm to 6.7.0, so I did that. But now I am running into a new error:

body-parser deprecated undefined extended: provide extended option ../../usr/local/lib/node_modules/cover-letter-snippets/index.js:16:17 snippets starting, listening on: localhost:3141 events.js:160 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE :::3141 at Object.exports._errnoException (util.js:1018:11) at exports._exceptionWithHostPort (util.js:1041:20) at Server._listen2 (net.js:1258:14) at listen (net.js:1294:10) at Server.listen (net.js:1390:5) at EventEmitter.listen (/usr/local/lib/node_modules/cover-letter-snippets/node_modules/express/lib/application.js:618:24) at Object. (/usr/local/lib/node_modules/cover-letter-snippets/index.js:26:5) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:389:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:504:3

Amruta-Ranade commented 5 years ago

Oh..never mind..got it working now. Still can't connect to the JSON server though :( Here's what I am doing:

  1. Run npm i -g cover-letter-snippets
  2. Run snippets
  3. The browser opens to the Cover Letter Snippets page.
  4. Click "Connect to JSON file". Nothing happens on screen. On the terminal, I get errors: body-parser deprecated undefined extended: provide extended option ../../usr/local/lib/node_modules/cover-letter-snippets/index.js:16:17 snippets starting, listening on: localhost:3141 Called GetSnippets! File exists already

I am running npm version 6.7.0

mattcheah commented 5 years ago

hey @Amruta-Ranade, I'm looking into this but I'm not sure whats going on. In the meantime, can you do a few things for me? Just make sure everything is updated (npm update) Check that your package is installed globally. Check if everything else works when using MongoDB instead of a JSON file. (I noticed you already added some snippets to the test one - remember to remove them if you don't want everyone else to see your info) If you still can't get it working, find the folder where you installed cover-letter-snippets (mine is at C:\Users\[my_user]\AppData\Roaming\npm\node_modules\cover-letter-snippets on windows) and comment out line 16 (app.use(express.urlencoded());) I don't remember why I put that in there but it seems to work for me if I take it out. Then save, run snippets again and let me know if it works?

Thanks!

Amruta-Ranade commented 5 years ago

Hey! I did everything you mentioned. The MongoDB part works fine. Still can't get the JSON part to work. (JFYI: This isn't a blocker. I can still complete my video project using the MongoDB option. Just trying to debug this out of curiosity. If it's taking up too much of your time, you can just let it be.)

I tried commenting out the line, but then got this error: env: node\r: No such file or directory

Amruta-Ranade commented 5 years ago

Oh..the error I am getting is "Called GetSnippets! File already exists". Can you share the path where the JSOn file is stored? I can try deleting it and running snippets again.

Amruta-Ranade commented 5 years ago

Ah! Got it to work! The jsonFilePath parameter was blank in json-routes.js. Added a value "file.js" for the parameter and it works fine :)

Before: jsonFilePath: ""

After: jsonFilePath: "file.js"