Rocket.chat: package-lock.json file has erroneous resolved = false fields

Created on 19 Sep 2019  路  7Comments  路  Source: RocketChat/Rocket.Chat

Description:

The package-lock.json file contains lines of the form https://github.com/RocketChat/Rocket.Chat/blob/f2f73afa480808af2a3a352c3ffd194047e25f5f/package-lock.json#L2991-L2995

Where the resolved field doesn't actually point to the resolved URI, but is just false. This prevents certain tools, such as node2nix in my case, from being able to use the lock file to fully resolve dependencies.

I found this issue which mentions such a problem: https://npm.community/t/npm-install-or-npm-update-turns-a-bunch-of-resolved-in-package-lock-json-from-real-values-to-false/3308, but without any good solutions other than rm -rf node_modules && npm install.

It would be great if this problem could at least be temporarily fixed on the 2.0.0 release branch.

Expected behavior:

package-lock.json should point all resolved fields to URI's

Actual behavior:

Some URI's are false

Most helpful comment

Is there an explanation about why this is happening ?

All 7 comments

For now I was able to write a hacky jq script to fix it:

cat package-lock.json | jq 'walk(if type == "object" then with_entries(if (.value | type) == "object" and .value.resolved == false then .value.resolved = "https://registry.npmjs.org/\(.key)/-/\(.key)-\(.value.version).tgz" else . end) else . end)' > package-lock-new.json

Is there an explanation about why this is happening ?

At least two people (probably more) in my team are seeing this. We've been on npm 6.13.4 for a while, and have started seeing false values appearing in the last few weeks I think (for me, it started today).

For me, removing node_modules isn't helping. The package.json file in the one package I looked at had a URL for _resolved, not false.

I've never used npm link.

Oops. This isn't the npm project. Oh well.

I've never used RocketChat.

there are no more "resolved": false but if that happens to some of you, you can try the following https://github.com/npm/npm/issues/20106#issuecomment-383770315

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amayer5125 picture amayer5125  路  3Comments

tanc picture tanc  路  3Comments

djeber picture djeber  路  3Comments

neha1deshmukh picture neha1deshmukh  路  3Comments

marceloschmidt picture marceloschmidt  路  3Comments