How to Use package.json Challenge Help!

I’m having the same problem (can’t continue because it seems that the author field is in the wrong place). Did anyone manage to solve it?

Here is how I added the author to the JSON object:

{ “author”: “Siva”,
“name”: “fcc-learn-npm-package-json”,
“dependencies”: {
“express”: “^4.14.0”
},
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“engines”: {
“node”: “4.4.5”
},
“repository”: {
“type”: “git”,
“url”: “https://idontknow/todo.git
}
}

1 Like

Solved it. Turns out that the URL isn’t that of the editor, but that of the app. I.e. open the app by clicking the sunglasses icon on the top left, then copy that URL.

18 Likes

I’m still having this problem. I’ve edited the package.json file as required (add an author key) on Glitch, and pasted in the app URL into the ‘Submit Solution’, and all I get is:

// running test
// tests completed

While the “package.json should have a valid “author” key” still shows an X next to it.

Note: the next lesson (add a description) also fails in the same way, when the default forked app from Glitch already contains a description key.

1 Like

I cant proceed with the validation still.
I used the App URL too and event copied the above code, it just doesn’t validate my answer and show me “package.json should have a valid ‘author’ key”.

Are you able to validate still?

1 Like

Bumping this for a solution.

For me, in my network tab I see a 404 error on the get request for the package.json file when providing the link to the live app.

There is no explanation anywhere about how to correctly provide glitch links for submission. Oversight?

I have found a solution:

The short and narrow is that the server.js code is wrong… it doesn’t have the correct endpoint. The interesting thing is why? As the project is correct when you clone it.

I think its an issue with the cloning process… sometimes it can fail, and when that happens you get the default glitch project, rather than the backend boilerplate you were meant to be cloning.

In the scenario where it does fail and you have the stock glitch project… the server.js code is invalid, so you get these 404 errors when you submit the project for testing on FCC.

If you successfully clone the project then the server.js code is correct (has an endpoint for serving the package.json file) and everything works.

Basically… try and clone the project again from this link:
Glitch

…and before you submit check the server.js code for this get route: app.route('/_api/package.json')

4 Likes

Yes, the cloned version works well.

Just to ask…

The correct way of starting the Apis and microservices tutorial is to clone the app form FCC?

because previously I created my own app on glitch …

Were you able to solve it ?
I have the same problem.
Here is the link to my package.json: https://github.com/sushreesoumya1/R1_100DaysOfCode/blob/master/package.json

Hi,
Could you please help me with github?

I have the same problem and have tried a lot to resolve but couldn’t.

Here is the link to my package.json: https://github.com/sushreesoumya1/R1_100DaysOfCode/blob/master/package.json

Your package.json file is fine, but the freeCodeCamp automated test needs a way to actually read that file to check it. It’s easy to miss but on the Introduction to the Managing Packages with npm Challenges page it instructs you to clone either this Glitch project or this GitHub repo which have a server.js file that creates an api route that sends the package.json file when requested. On line 27 of server.js it defines what happens when a GET http request is sent to the route ‘/_api/package.json’; in this case the server sends the package.json file as a text string, which is what allows the automated test to view your package.json and verify you’ve made the correct changes.

3 Likes

Hi,
Now, I have forked it, cloned it, did the changes and committed. Still, it is not getting accepted.
here is the new one: https://github.com/sushreesoumya1/boilerplate-npm

:frowning: what to do now?

What are you submitting as a solution? Your GitHub link? I don’t think the freeCodeCamp automated test is configured to be able to read that. It’s looking to go to the link you provide + ‘/_api/package.json’ and receive a text string of just the package.json file. The code in server.js accomplishes this, but that code must be running as a Node.js server somewhere: Glitch.com will not only host your code with an editor but run it for you on their servers (click the Show button on the top left for a link to the generated url running the code), while GitHub is just hosting the text files in its own format.

Thanks a lot!!! :smiley:
I’ll do it in Glitch.

I thought that the github link would me enough but it’s not. Thanks a lot for the explanation.

I cloned the glitch repo, edited the package.json file and paste the app url on the submission but still receiving “package.json should have a valid “author” key”
Please help.

1 Like

This is how you are suppose to write “author”: “Jane Doe”,
also click on show then copy paste the url to send it to freecodecamp
{

“name”: “hello-express”,
“version”: “0.0.1”,
“description”: “A simple Node app built on Express, instantly up and running.”,
“main”: “server.js”,
“author”: “Anna”,
“scripts”: {
“start”: “node server.js”
},
“dependencies”: {
“express”: “^4.16.4”
},
“engines”: {
“node”: “8.x”
},
“repository”: {
“url”: “https://glitch.com/edit/#!/hello-express
},
“license”: “MIT”,
“keywords”: [
“node”,
“glitch”,
“express”
]

Same problem here. Took me a while…:sweat_smile:
SOLUTION: Paste the link to the actual app.
i.e.: https://name-of-your-app.glitch.me/

1 Like

Hi,

I solved the problem by using the link given in
“Introduction to the Managing Packages with npm” Challenges at the very beginning of “Managing Packages with Npm”.
Look for " Start this project on Glitch using this link … to start a glitch project that is linked to freecodecamp.
As soon as I used this link, I was able to evaluate my tasks.

Hope, I can help you out with this hint.

1 Like

I had the same issue as many of you and the only solution that worked for me was when I did the following:

  1. In Glitch, upper-left drop-down, chose ‘New Project’
  2. At bottom of this window, chose ‘Clone from Git Repo’
  3. From GitHub (https://github.com/freeCodeCamp/boilerplate-npm/) clicked ‘Clone or download’ and clicked the copy button (clipboard icon)
  4. Pasted the link to the repo into the window on Glitch
  5. At this point I had an almost empty Glitch project, just a Readme.md and an empty ‘assets’ folder. So I downloaded the GitHub repo as a ZIP so I could add what was missing.
  6. Extracted the contents of the ZIP.
  7. On Glitch, clicked ‘New File’ and then ‘Upload’ and uploaded the package.json from the extracted repo.
  8. Added the author key as requested
  9. Also had to upload the server.js file to get the tests to pass.

I’m not sure why the project didn’t work from Glitch to begin with or why it didn’t properly clone into Glitch, but this was how I got past this block.

2 Likes

Thank you for your answer! It’s working for me.
As I can see it wasn’t properly cloned because there are two branches and by default the master branch was clonned. And all code stores in gomix branch.

I solved it by uploading the project “https://github.com/freeCodeCamp/boilerplate-npm/” on cloud9. Then i was getting error “not found” when i was parsing the URL on freecodecamp. The freecodecamp page were looking for “projectUrl//api/package.json” instead of “projectUrl/api/package.json” so i corrected in the server.js and it worked