How to Use package.json Challenge Help!

Very new here, having trouble completing the package.json package on beta.bootcamp.com -
Managing Packages with npm

  • introduction to the Managing Packages with npm Challenge

the task was to add an author-field.

This seems pretty straight forward, but I cannot complete it,
I am not sure if I am saving my project wrong on glitch,


or pasting the wrong link.

Has anyone tried it?

Best
K

The beta site you linked to gave an error. Can you check for typos in your link?

For your package.json file a few things need to be fixed.

  • A version field is required or the package is invalid.
  • A keywords, description, bugs, licenses, and contributors field is recommended.
1 Like

hello, sorry about that,
the exact page i am trying to complete is here

the package.json file on glitch that i am pasting is her

the message i am getting returned is:
“…package.json should have a valid “author” key…”
(I tried adding a version and still getting same returned result).

I am not sure if:

  1. my glitch settings or link is incorrect
  2. the added code or syntax,
  3. a beta bug, since… its beta…

Thanks
K

It’s not a beta bug, you haven’t included an “author” key, it’s required in package.json. Once you add it in you should be good. Also include a “version” key.

Hello Nsuchy,

here is what is in my package.json

{
“name”: “fcc-learn-npm-package-json”,
“author”:“Kevin K.”,

“dependencies”: {
“express”: “^4.16.2”
},
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“engines”: {
“node”: “4e.4.5”
},
“repository”: {
“type”: “git”,
“url”: “https://idontknow/todo.git
}

}

i have even tried it with this variation, and with “version” key at “0.1.0”:
“author”:{
"name ":“Kevin K.”
},

were you able to access my package.json fill with the link i provided earlier.

would someone kindly tell me how do i get the link to paste into the project check textbook?

1 Like

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: The friendly community where everyone builds the web

…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.