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

npm install -S fastify@2.00

Then I used

npm install -E rfdc@1.1.3

And then my package.json file revealed this:

{
  "name": "labs-2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "node test"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "fastify": "^2.0.0",
    "rfdc": "1.1.3",
    "semver": "^7.1.3"
  }
}

when I run

node test.js

I get

assert.js:385
    throw err;
    ^

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

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!

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:

    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

    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.

Categories

Upcoming Training