freeCodeCamp: how-to-npm issues are mostly human error compounded by an annoying bug

Challenge http://www.freecodecamp.com/challenges/waypoint-manage-packages-with-npm.

The dist-tag bug in how-to-npm 2.0.0 is trivial if you know the cause and how to deal with it. The bug is actually triggered entirely by human error: e.g., if you try to add or remove an invalid dist-tag, 403 or 404 errors will begin to accumulate. The tutorial should have delivered a descriptive error message in these cases.

If at any point you see a 403 or 404 error your only recourse is to run how-to-npm again, and in some cases you may need to repeat a prior step.

Here are some common causes for these errors;

  1. Try not to use commands out of sequence. For example, avoid using npm publish on steps that do not ask you to publish. Even if you enter a valid npm command, the tutorial will often break if you do things it isn’t expecting for a given test. If you need to repeat a command, you may be better off returning to the relevant test before picking up at your current step.
  2. npm version should be followed by a version number (e.g., 1.0.2) or by a keyword indicating a semver type (e.g., ‘patch’). See npm help version for examples. (You may also set the version number manually in package.json, but npm version works if you understand the syntax.)
  3. You can not change the dist-tag of the version tagged latest until you’ve assigned latest to a different version.
  4. dist-tags can not be added to a version number beyond the highest existing version. For example, if you’ve set and published version 2.0.0, you can not add a dist-tag to 2.0.1.
  5. Finally, if you set latest to a low number (e.g., 0.0.1) you’re eliminating or vastly reducing the available version numbers to which you can assign dist-tags.

Any of these (and more like them) will cause 403 or 404 errors and will require users to step back, rerun how-to-npm, and be careful not to repeat mistakes.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 25 (7 by maintainers)

Most upvoted comments

The problem with this entire set is that it’s designed to teach by guessing. Please make simple and clear instructions in a tutorial. Don’t TRY to fool students by leaving the solution out of the lesson. I still don’t know how to tell the name of my package or what the function of a package or dependency actually is.

This is actually ridiculous and I cannot pass it no matter what I have done. I skipped the entire challenge after it would NOT work the 1000 different things I tried, I have spent 3 hours on this.

The how-to-npm should not list steps as “Completed”… if things have been broken inside that will make further steps impossible.

I wish someone could post actual working commands. I wish I knew where the clear, simple workarounds are posted. I should have looked elsewhere for more informative npm information before wasting so much time on this challenge.

I guess I’m having the same problems with npm dist-tag add <pkg> <tag> and have tried several workarounds. Can you give us credit for this tutorial if we make it through 10? When are you guys gonna update or fix this?

@kaym0 honestly, you won’t miss much. Most of the generally applicable npm knowledge is at the beginning of that challenge. I recommend you keep on moving forward.

@kaym0 yes - this Node School module is seriously broken. We are working on a replacement for it - something that would run on top of HyperDev (instead of the command line) and would not involve a lot of package creation-specific tasks (that you can learn if and when you choose to create npm packages yourself).

Would you be interested in helping us design a replacement?

@thenerdywiz We are removing the Node School challenges completely in favor of our own challenges. These are in the beta curriculum: beta.freecodecamp.com/map

I originally had this problem, but solved it by following these instructions: https://github.com/workshopper/how-to-npm/issues/45#issuecomment-230500918