Requiring a package from the package library is unreliable

The problem (aka bug)

I am using Postman on Windows 11.

I have created a package named ‘extera-explorer-api’ and I am trying to use it in a post request script.

The package contains at the bottom the exports:

module.exports = {
    verifyLoginResponse,
    verifyUser,
    verifyToken,
    verifyTokens
};

The post-request script is:

const apiTests = pm.require('@exteradesign/extera-explorer-api');

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

const responseBody = pm.response.json();

apiTests.verifyLoginResponse(responseBody, 'login response')

pm.environment.set("accessToken", responseBody.tokens.access.token);
pm.environment.set("refreshToken", responseBody.tokens.refresh.token);

I get three different behaviors when executing the request:

  1. The script runs successfully without any errors. This is what I expect to happen all the time, but it does not.
  2. The request evaluates the test that is directly in the post-request script but then fails with "Error: Cannot find package ‘@exteradesign/extera-explorer-api’
  3. The request evaluates all tests, both the one in the post-request script and the ones in the verifyLoginResponse function from the package, but the console shows the "Error: Cannot find package ‘@exteradesign/extera-explorer-api’

Observations

The first behavior seems to happen only the day I created the package. It may be that it will happen again after I restart Postman, but I have not tried.

The second behavior happens after I wake up my laptop and try to send the request. Repeatedly sending the request exhibits the same behavior.

The third behavior happened after I fiddled with the request script (not the package) and then reverting (via undo) to the original script. I am not sure what made it change from the second to the third behavior.

Expected behavior

I expect only the first behavior: reliably being able to use the exports from the package.

An update

After restarting Postman, it reverted to the first behavior (everything working fine).

Also, regarding the third behavior: while the tests contained in verifyLoginResponse were listed as Pass, the script did not execute the subsequent code lines. I noticed this when I looked at the environment variables and did not find the accessToken or the refreshToken variables.