Dont understand npm dependencies

Tell us what’s happening:

  "name": "fcc-learn-npm-package-json",
  "description": "A project that does something awesome",
  "keywords": [ "freecodecamp" ],
  "license": "MIT",
  "version": "1.2.0",
  "author": "Sokun",
	“dependencies”: {
“express”: “^4.17.1”,
“moment”: “^2.10.2”
	},
	"main": "server.js",
	"scripts": {
		"start": "node server.js"
	},
	"engines": {
		"node": "8.11.2"
	},
	"repository": {
		"type": "git",
		"url": "https://idontknow/todo.git"
	}
}

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36.

Challenge: Manage npm Dependencies By Understanding Semantic Versioning

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

Also, descriptive thread titles, such as “Why does my function return undefined?”, are more likely to elicit helpful responses than generic titles, such as “Help please”.

This is my code

{
“name”: “fcc-learn-npm-package-json”,
“author”: “Martin Lauf”,
“description”: “A project for back end”,
“keywords”: [
“developer”,
“javascript”,
“freecodecamp”
],
“license”: “UNLICENSED”,
“version”: “1.0.0”,
“dependencies”: {
major.minor.patch  2.10.2
“moment”: “^2.10.2”
},
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“engines”: {
“node”: “8.11.2”
},
“repository”: {
“type”: “git”,
“url”: “https://idontknow/todo.git 3”
}
}

i cant do this lesson ’ Managing Packages with Npm - Manage npm Dependencies By Understanding Semantic Versioning’

Hello there,

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).


We cannot help much more, with the information available. Would you be able to post a link to your project?

One thing to note:

“dependencies”: {
“express”: “^4.17.1”,
“moment”: “^2.10.2”

The quotation marks used here are not regular, and could cause issues.

these are the links https://patch-innovative-gate.glitch.me and https://www.freecodecamp.org/learn/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning

Thank you, for providing that. This is what I think:

  1. I would not be surprised if the use of the uncommon quotation marks (“”) as opposed to regular quotation marks ("") is causing issues
  2. I am unable to access the live app, because the server appears to be down. The tests cannot access the app like this either.

So, I suggest you fix the quotation marks. Then, check if the app is being served. If not, check the logs in Glitch. Look for any error messages, and work from there.

Hope this helps

i fixed the quotations but it still doesnt work?

im too tired to continue

  1. You have this major.minor.patch 2.10.2 in the dependencies, that is not valid JSON.

  2. You need to keep express in the dependencies.

  3. You have to remove the ^ from the moment version number.

1 Like

thanks i figured it out

what does learning this stuff help with?

What do you mean?

If you are talking about how to use package.json and npm it is pretty much at the center of all modern web development, so much so it has become a problem.

Anyway, it will become more clear as you move forward. For now, just think of it as a way to add information and “metadata” for the extra “software” you might add to your project.

Ok thanks for telling me that :slight_smile: :smile:

How did you figure it out? I have been trying for hours

“dependencies”: {

"moment": "2.10.2",
	"express": "^4.17.1",
"dependencty1": "^2.10.2"
},

Hi, do you have a question?

Looks like you have a typo in the name of your dependency.

Yeah I have fixed the typo. Just a reply to the previous person Alcides1987