Test not passing on valid input

Tell us what’s happening:

I followed the instructions on the page. The test didn’t pass. Then I used the hint and followed the instructions on hint link

Your code so far

{
    "name": "fcc-learn-npm-package-json",
    "author": "Arslan",
    "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"
    }
}

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.

Challenge: undefined

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package

It doesn’t look like there’s anything wrong with your JSON. However, the challenge you linked only asks for “author”, so perhaps you should try to delete everything besides that, and see if you pass the test.

{
 "author": "Arslan",
}

Looking at the challenges after this one, you’ll see that you’ll add all of the other stuff later. (If this doesn’t work, try omitting the curly braces, as the example doesn’t use them on the challenge page.)

1 Like

This isn’t working for me either, same problem. Valid inputs, won’t pass the solution. I wonder if there’s some bug or something right now?

Mine just started passing, no change to what I did before, so something is “better”.

1 Like

I’m having the same issue as mentioned in this post. Just started this section today and have the exact issue. Here’s my user agent in case it helps:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36.

I’ve also tried disabling AdBlockPlus and refreshing the window but this didnt change anything. In the Chrome Dev Tools Console I see these two errors:

jquery.js:3841 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 _callee$ (https://www.freecodecamp.org/js/frame-runner.265bddf5f727538e7585.js:25:88133), <anonymous>:1:102)
    at s (https://www.freecodecamp.org/js/frame-runner.265bddf5f727538e7585.js:25:25742)
    at f (https://www.freecodecamp.org/js/frame-runner.265bddf5f727538e7585.js:25:26044) undefined
frame-runner.js:70 SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.eval (eval at _callee$ (VM263 frame-runner.265bddf5f727538e7585.js:25), <anonymous>:1:102)
    at s (VM263 frame-runner.265bddf5f727538e7585.js:25)
    at f (VM263 frame-runner.265bddf5f727538e7585.js:25)

Here’s my glitch in case it helps:

Quick Update: This exact issue happens for the next few challenge: adding the description key, the keywords array as well. On the keywords challenge I see a new error where I clicked submit and then the UI showed the test output:

// running tests
package.json should have a valid "keywords" key (Test timed out)
"keywords" field should be an Array (Test timed out)
"keywords" should include "freecodecamp" (Test timed out)
// tests completed

Unless there is something happening on the backend test runners here, I’m out of ideas. I’m on a very fast and stable internet connection. Any help is appreciated.

FYI: I’m not a beginner but wanted to go through these challenges for fun/practice and while the other sections for javascript have been working fine for the past few months this section appears to be fairly broken for running the tests.

@brianfink Using your Glitch project url, I was able to pass the tests without issue for the Add Keywords to Your package.json challenge. What is the exact url you tried to submit?

Hi @RandellDawson, thanks for looking into this. I tried to submit using this url:

Trying again just now (after I saw your response) I’m still getting these errors:

// running tests
package.json should have a valid "author" key
// tests completed

I decided to try using a public github repo with the package.json I’ve been updating in the interim; same content. The online submission for the FCC challenges seems to have the same failure using that.

That is not the actual url that you can view. If you click the Show button at the top, you can Open the project in a New Window. The url which shows in the new window is working url for the project. The link you posted is for viewing/editing the project code.

6 Likes

That worked, thanks! I must have some how missed that the expected URL for the submission was where the front facing app could be viewed. Personally, that’s extremely confusing for a section dedicated entirely to a file like package.json.

In any case, I appreciate your help!

1 Like

I can confirm this is an ongoing issue; reporting not valid input when it is valid. Tried with Glitch, JSBin, Codepen and my own server. The pure text json of my most recent attempt is here. I tried in Chrome and Safari.

@tomusn83 First, we would need to see the project code (Glitch, JSBin). Second, what url were you trying to submit for the challenge?

Sorry, I had made a hyperlink. The URL is: http://tomusn.com/tmp/package.json. Also, Codepen: https://codepen.io/tomusn83/pen/VwYbaaL.

You can not just post a link to a json file. You have to incorporate into the project. You must clone the GitHub project specified to in the introduction section and update the package.json included with it. Then you must have a live working app that calls some code in the project to validate your package.json is correct.

Hi everybody,

This is my first post :wink:

I cloned the original GitHub project, loaded it to a personal repo on GitHub. After having updated the ‘package.json’ file, I copy/pasted this link : https://github.com/Braathen75/boilerplate-npm

Unfortunately, the test failed… And I don’t understand why. Could you help me with this ?

Thank you so much for your help,

Cheers,

Mehdi.

PS : long live FreeCodeCamp !!

UPDATE: I finally passed the test using Glitch! Actually, it’s obvious: it was impossible to validate anything without using a platform… I’m really a rookie with Git and Glitch lol :wink:

For all those who are struggling, I was able to pass test using the following steps

  1. Click on Share button/dropdown
  2. Click on Live App
  3. Copy the URL and submit in the challenge

Hopefully that works for you

8 Likes

The instructions on which URL to use really ought to be clearer in the lesson description… Glitch’s big ‘share’ button points to the project URL, not the live app URL, and the lesson doesn’t specify it needs to be the live URL.

2 Likes

This input field’s placeholder shows a codepen.io URL, so I tried that when the file’s raw Github URL failed.
Checking the console, what ever one pastes into the “Solution” input /_api/package.json will be appended. It seems that only Glitch works with the steps described by previous posters here, even though on the first page of the tutorial it says “Glitch” or “Github”.
As @Kohota107 already said, the URL required should be much clearer described.

  1.    Simply use the link for glitch in the instructions page
    
  2.    Add the name and author..like below
    

    {
    “name”: “fcc-learn-npm-package-json”,
    “author”: “xyz”,
    “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
    }
    }

  3. Now Click on    Share ---> LiveApp ---> Copy the URL(...containg glitch.me)
    

Hope this will work !!!