Welcome to the Linux Foundation Forum!

Lab 6.2 what is going wrong here?

For lab 6.2 to install fastify with semver range starting at 2.0.0 and accepting all new minor and patch versions. I used the command

  1. npm install -S fastify@2.00

Then I used

  1. npm install -E rfdc@1.1.3

And then my package.json file revealed this:

  1. {
  2. "name": "labs-2",
  3. "version": "1.0.0",
  4. "description": "",
  5. "main": "index.js",
  6. "scripts": {
  7. "test": "node test"
  8. },
  9. "keywords": [],
  10. "author": "",
  11. "license": "ISC",
  12. "dependencies": {
  13. "fastify": "^2.0.0",
  14. "rfdc": "1.1.3",
  15. "semver": "^7.1.3"
  16. }
  17. }

when I run

  1. node test.js

I get

  1. assert.js:385
  2. throw err;
  3. ^
  4.  
  5. AssertionError [ERR_ASSERTION]: fastify should be greater than or equal to 2.0.0, while accepting all future MINOR and PATCH versions
  6. at Object.<anonymous> (/Users/lauchschool/Downloads/labs/ch-6/labs-2/test.js:18:1)
  7. at Module._compile (internal/modules/cjs/loader.js:1076:30)
  8. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
  9. at Module.load (internal/modules/cjs/loader.js:941:32)
  10. at Function.Module._load (internal/modules/cjs/loader.js:782:14)
  11. at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
  12. at internal/main/run_main_module.js:17:47 {
  13. generatedMessage: false,
  14. code: 'ERR_ASSERTION',
  15. actual: false,
  16. expected: true,
  17. operator: '=='
  18. }
  19.  

Then when I read back through the reading, I read that ^2.0.0 means that fastify accepts any minor or patch versions that are equal to 2.0.0 or greater than 2.0.0. Which is what is listed in my package.json file.

I am having difficulty debugging this.

I guess I either have a misunderstanding or, something else is wrong.

Can someone please help me. Tell me what is going wrong, and what my misunderstanding is. Offer a solution or provide feedback however you'd like.

Thanks!

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Answers

  • hey @andrewpartrickmiller

    This is a (ironically) due to a breaking change in the semver package which was released in a minor instead of a major.

    The following validate.js line:

    1. assert(range === '>=2.0.0 <3.0.0', 'fastify should be greater than or equal to 2.0.0, while accepting all future MINOR and PATCH versions')

    needs to be updated to

    1. assert(range === '>=2.0.0 <3.0.0-0', 'fastify should be greater than or equal to 2.0.0, while accepting all future MINOR and PATCH versions')
  • This issue is no longer an issue. The test passes without any bugs

  • I downloaded the new labs and ran the code I described earlier in this post, with the typo corrected, and the test passed.

  • thanks for confirming @andrewpartrickmiller !

This discussion has been closed.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training