matrix-org / matrix-encrypt-attachment

JS/TS library for encrypting and decrypting file attachments in Matrix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

package cannot be installed from npm

hughns opened this issue · comments

Running npm install matrix-encrypt-attachment results in the following error:

npm ERR! code ENOVERSIONS
npm ERR! No valid versions available for matrix-encrypt-attachment

Despite npm view matrix-encrypt-attachment showing an available version:

https://registry.npmjs.org/matrix-encrypt-attachment

matrix-encrypt-attachment@1.0.1 | Apache-2.0 | deps: none | versions: 1
JS/TS library for encrypting and decrypting file attachments in Matrix
https://github.com/matrix-org/matrix-encrypt-attachment#readme

keywords: matrix-org

dist
.tarball: https://registry.npmjs.org/matrix-encrypt-attachment/-/matrix-encrypt-attachment-1.0.1.tgz
.shasum: 6d3e7141f7c99d3e04ce44dad20ab6168240d0ff
.integrity: sha512-rajh0hHCQ1Hyy9VdImdCnJJSArEvFrKOq+tztHK4tqdSGBgQ1gfpDNt6ri8W/krmn+qBwQIS7Y+7QtHOf8ZZHg==
.unpackedSize: 340.1 kB

maintainers:
- matrixdotorg <matrix@matrix.org>

dist-tags:
latest: 1.0.1

published 4 days ago by matrixdotorg <matrix@matrix.org>

The problem appears to be due to bad abbreviated metadata (application/vnd.npm.install-v1+json) being returned from the npm registry. This is reproducible with curl -H "Accept: application/vnd.npm.install-v1+json" https://registry.npmjs.org/matrix-encrypt-attachment which returns the malformed JSON:

{"name":"matrix-encrypt-attachment","modified":"2022-01-14T16:33:31.505Z"}

I've raised the issue with npm support.

The workaround is to directly reference the tarball in dependent projects. e.g. matrix-org/matrix-files-sdk@2264129#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

After publishing 1.0.2 the issue has been resolved. 🤷‍♂️

Correct metadata is now being returned for both 1.0.1 and 1.02.