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

2 Likes

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

3 Likes

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?

6 Likes

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.

Hi @camperextraordinaire, 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 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!

3 Likes

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.

1 Like

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

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 !!

2 Likes

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

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

4 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 Like
  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 !!!

2 Likes

What about the platform repl.it? All of you are refering to Glitch, but now in the instructions it refers to repl.it… and it doesn’t work either.
Any suggestions?

7 Likes

Welcome,

I suggest you open your own topic about your own code. Be sure to format your code correctly. Or, better yet, include a link to your project.


This thread has been closed as it contains outdated information.

Thank you

1 Like