Managing Packages with Npm - How to Use package.json, the Core of Any Node.js Project or npm Package

@mscanza I have to agree these are by far the hardest challenges for me as well, I just keep trying different stuff until it passes. I think glitch may have some glitches… but I really like MongoDB Lab (I have used it to demo prototypes at work). I think the challenge is coming up with an environment where the challenges can be worked that is free and open sourced. It would probably be easier if they set up an EC2 type instance in the cloud and built the challenge environment in the cloud but that costs a lot of money.

Hi Johnny, I actually figured out the source of much of the confusion. FCC is going to adjust the instructions. Make sure you login to Glitch from GitHub, not Facebook or any other options, this fixed everything, allowing the template to import correctly from github. Logout of glitch and back in using GitHub oauth.

1 Like

Hi FCC community!
I’m encountering a fundamental problem with this same assignment. Is this a FCC issue, a Glitch issue, or a user issue? Reproduction Steps:

  1. Browsed to glitch[dot]com, Signed Up with GitHub. Logged Out, Logged Back in using GitHub.
  2. Per section intro instructions, visited glitch[dot]com/#!/import/github/freeCodeCamp/boilerplate-npm to clone boilerplate code into new glitch project.
  3. Within project’s navigation panel, opened package.json and added new key/value pair to existing JSON object: "author": "Bernard Faucher",
  4. Using Glitch share button, obtained public URL: glitch[dot]com/~furry-cobalt
  5. Pasted the above URL into FCC’s solution field and clicked submit.
  6. Test output field displays: Unexpected token &lt; in JSON at position 0, summarizing chrome console error: jQuery.Deferred exception: Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at Object.eval (eval at <anonymous> (:1:1635), <anonymous>:1:102) at l (<anonymous>:2:29375) at c (<anonymous>:2:29677) undefined
  7. Per forum suggestion, used Glitch > Tools > Console to inspect file for errors using the command line: app@furry-cobalt:~ 17:32 $ cat package.json { "author": "Bernard Faucher", "name": "fcc-learn-npm-package-json", "dependencies": { "express": "^4.14.0" }, "main": "server.js", "scripts": { "start": "node server.js" }, "engines": { "node": "8.11.2" }, "repository": { "type": "git", "url": "https://idontknow/todo.git" } }
  8. ¯\_(ツ)_/¯

Any advice would be much appreciated! Thanks,
-B

@BernardFaucher, if I remix your project, (remix means copy/fork) and submit the remixed project it passes for me without changing a single thing, which means the app in and of itself is fine, the problem is somewhere with your glitch connection, so log out of glitch and log back in using your github and try again, if that doesn’t work, log out and log back in and try with a fresh copy of the boilerplate.

best of luck

Thanks for the swift reply, @Dereje1 !
I followed your advice re: logout > login, and with remixing the project to start fresh. I’m still seeing the same error, but it’s nevertheless awesome to get an external sanity check - it means I can safely rule out a problem with the test script & my own code, and can hold off on contacting Glitch support. For anyone following along at home, the next thing I’m going to try will be disabling various Chrome browser extensions, starting with DuckDuckGo Privacy Essentials 2019.3.22. If that approach doesn’t pan out, I’ll try a different browser.
Fingers Crossed,
-B

:trumpet:womp womp :trumpet:
Disabling my Chrome extensions didn’t do it.
Neither did switching to Edge browser.
Edge console output is, however, different from Chrome’s:

1. HTML1300: Navigation occurred.

[how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package (1,1)](https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm/how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package)
2. CSS3121: The media query -ms-viewport has been deprecated.

3. stripe has loaded

[component---src-layouts-index-js-bf46dd27ca03e7e59552.js (12,4315)](https://learn.freecodecamp.org/component---src-layouts-index-js-bf46dd27ca03e7e59552.js)
4. SCRIPT5007: SCRIPT5007: Unable to get property 'next' of undefined or null reference

[how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package (12,869)](https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm/how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package/)

hmmm… hard to trouble shoot since your error can’t be duplicated, are you seeing anything in your gitch editor log? (you can see your log by clicking in the bottom left of your glitch editor)
Also did you get a new boiler plate after you logged in and out using your github account?

Thanks for the follow-up!
My newly-cloned project url (after re-auth’ing) is https://glitch.com/~platinum-ornament
From the Glitch editor > Logs console, I see :point_down: ; nothing strikes me as off…

node v8.15.0, with pnpm

3:39 PM

Installing...

3:39 PM

a minute ago

Performing headless installation

3:39 PM

Resolving: total 1, reused 0, downloaded 0

3:39 PM

Resolving: total 1, reused 0, downloaded 0

3:39 PM

Packages: +49

3:39 PM

+++++++++++++++++++++++++++++++++++++++++++++++++

3:39 PM

Resolving: total 49, reused 49, downloaded 0

3:39 PM

Resolving: total 49, reused 49, downloaded 0

3:39 PM

Resolving: total 49, reused 49, downloaded 0, done

3:39 PM

3:39 PM

dependencies:

3:39 PM

+ express 4.16.4

3:39 PM

3:39 PM

Total install time: 6697ms

3:39 PM

a minute ago

Node.js listening ...

@BernardFaucher, log looks fine and your new link passes for me without forking… , your first link was failing

Next, I’ll try switching over to the Mac OS partition of my machine. I’d expect that the problem would be OS-agnostic, but ya never know until you try. I appreciate the support!

I don’t think it’s your machine

Pics, lest I be suspected of trolling:

I’m going to reach out on the Glitch forums next, but the fact that my projects are working for you is really throwing me…

Could you try clearing your fcc cache, logging out , logging in, etc… , your last link should be good if it passes for me, so I think glitch can be eliminated…

@BernardFaucher, did you change anything in your glitch app since the last time you posted the link? now it is failing again…

also does this link pass for you? https://shiny-crowd.glitch.me/

freecodecamp.org > F12 > Application > Clear storage > Clear site data.
Then, at https://learn.freecodecamp.org/apis-and-microservices/managing-packages-with-npm/how-to-use-package-json-the-core-of-any-node-js-project-or-npm-package > paste and submit https://glitch.com/~platinum-ornament > Unexpected token < in JSON at position 0

On the Glitch support forum, I’m searching that error. first result points to https://support.glitch.com/t/issues-with-imgur/5275 reading that now…

welp, https://shiny-crowd.glitch.me/ passed immediately. so confused!

very strange, that is your own file ‘remixed’, so I have seen this problem before on the forum, and logging out and logging back in with a new copy of the boilerplate almost always fixes it, your link was first passing for me without remixing it, so some where along the way it got corrupted again, my only suggestion is to repeat the above process again with a new link

Very strange, indeed! Thanks a mil for staying with me @Dereje1 - and to anyone experiencing the same in the future, here’s a link to the thread I started on the Glitch support forum:

Hey @BernardFaucher, I managed to get the first test to pass by submitting the “Live App” URL. I noticed that the previous links you were trying were “Project Page” URLs. The link from @Dereje1 is a Live App URL, which I assume is why it worked for you.
Here’s a picture of what I’m talking about:

26

1 Like