Node Js Fix The Dependencies

Overview

In this lab, we're going to explore how to resolve dependency issues in Node.js. We've provided a bare-bones project in lib/ — it currently fails all its tests. Your job is to make sure the tests pass.

Goals

  1. Explain errors that npm prints during npm install
  2. Determine solutions based the errors that npm provides
  3. Explain npm peerDepencies

Getting started

Run npm test — you'll notice that everything crashes. Like before, we'll need to install a few packages just to get tests to run. But even with those packages installed, things won't run quite as expected.

peerDependencies

Before we set you loose, there's one last thing we need to introduce (and we promise not to make the whole introduction in rhyming couplets).

npm has a concept of peerDependencies that's important to understand. peerDependencies (which can be declared in a package.json just like dependencies and devDependencies) describe packages that require a "host" package — you can think of peerDependencies as plugins. One example of a host package that we've already encountered is Chai.js. Each Chai plugin has chai as a peerDependency, meaning that the plugin expects that it will be required in an environment that also has chai.

NOTE: There will be a warning that a peerDependency hasn't been met no matter what. It's currently an open issue on npm: https://github.com/npm/npm/issues/3218. The trick is still to make sure to get the right version of the peerDependency from the repository that we've provided. (Remember that you can refer to specific commits.)

Unlock your future in tech
Learn to code.

Learn about Flatiron School's Mission

With a new take on education that falls somewhere between self-taught prodigy and four-year computer science degree, the Flatiron School promises to turn students with little programming experience into developers.

In the six months since the Manhattan coding school was acquired by WeWork, it has spawned locations in Washington, D.C., Brooklyn, and London. Now, WeWork is opening a fourth Flatiron School location, this time in Houston.

Adam Enbar, Flatiron School's cofounder, believes now is the time to grow. "How the world is changing has impacted working and learning in very similar ways. We think education fundamentally is about one thing: enabling people to pursue a better life."

Learn. Love. Code.
Students come to Flatiron School to change their lives. Join our driven community of career-changers and master the skills you need to become a software engineer or a data scientist.
Find Us