How do you use dependencies in npm?

I’m in the backend and API course of freecodecamp, the part where it tells you to “Expand your project with external packages from npm” the instructions tells me to add version “1.1.0” of the @freecodecame/example package to the dependencies field of your package.json file. It says that I need to store it in this format. I was trying different things for almost an hour now and I would appreciate it if someone could explain to me what is going on and how I can fix this, thank you!

"dependencies": {
  "package-name": "version",
  "express": "4.14.0"
}

I’ve pasted the link of the browser into freecodecamp and this came up:
// running tests

"dependencies"

should include

"@freecodecamp/example"

.

"@freecodecamp/example"

version should be

"1.1.0"

. // tests completed

This is my code so far

{
	"name": "fcc-learn-npm-package-json",
	"author": "A",
	"main": "server.js",
	"keywords": ["title", "pattern", "required", "freecodecamp"],
	"license": "MIT",
	"version": "1.0",
  "dependencies": {
    "package-name": "@freecodecamp/example",
    "express": "1.1.0"
	},
	"description": "A starter project for my learning journey with freecodecamp",
	"scripts": {
		"start": "node server.js"
	},
	"repository": {
		"type": "git",
		"url": "https://idontknow/todo.git"
	},
	"dependencies": {
		"express": "^4.18.1"
	}
}

https://boilerplate-npm-1.air-conditionin.repl.co/

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

Challenge: Managing Packages with NPM - Expand Your Project with External Packages from npm

Link to the challenge:

Thank you very much for reaching out, I’ve tried fixing it the way you told me to but without luck it doesn’t work. This is the error message it :
// running tests "dependencies" should include "@freecodecamp/example" . "@freecodecamp/example" version should be "1.1.0" . // tests completed
and this is the code. I tried deleting line 20 to 22 because in the original package, it doesn’t exist but the error messages come up.

https://boilerplate-npm-1.air-conditionin.repl.co/


I got an error message after putting the original express with the new express.

I added a comma at the end of line 9 and the same error messages still pop up.

Which one is the incorrect express?

This is the original starter code:

This is my code, I tried running it again but results are the same

My build was failed in Heroku after add the following
@freecodecamp/example”: “1.1.0”,

The error i got
Installing node modules

   npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.

   npm ERR! 

   npm ERR! 

   npm ERR! Missing: @freecodecamp/example@1.1.0

   npm ERR!

ii executed the npm install in the command line even though it fails.

I forgot the comma after the express version UGGGGG

Although I am a novice at full-stack development, I can appreciate how others are struggling with this problem. However, I was unable to locate giving version to a package in dependencies.
I was working on the dependencies section like this.

 "dependencies":{
   "package-name":"@freecodecamp/example",
    "express":"1.1.0"
	},

Contrarily, we supply a package’s version in the dependencies in this manner.

{
  "name": "fcc-learn-npm-package-json",
  "author": "Swapnil Jain",
  "description": "A project that does something awesome",
  "keywords": [ "freecodecamp", "nodejs learning", "test3" ],
  "license": "MIT",
  "version": "1.1.0",
  "dependencies":{
    "@freecodecamp/example" : "1.1.0",
    "express":"1.1.0"
	},
	"main": "server.js",
	"scripts": {
		"start": "node server.js"
	},
	"repository": {
		"type": "git",
		"url": "https://idontknow/todo.git"
	}
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.