question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

README published by yarn 2 is not correctly shown on verdaccio

See original GitHub issue

⚠️⚠️⚠️⚠️ Workaround available, scroll down ⬇️ ⚠️⚠️⚠️⚠️

Describe the bug

README is not correctly shown on verdaccio using yarn npm publish

To Reproduce

mkdir yarn-verdaccio-readme
cd yarn-verdaccio-readme
yarn set version berry
echo '
npmPublishRegistry: http://localhost:4873
unsafeHttpWhitelist: [localhost]
' >> .yarnrc.yml
echo '
{
  "name": "yarn-verdaccio-readme",
  "version": "0.1.0"
}
' > package.json
echo '# yarn-verdaccio-readme' > README.md
yarn
docker run --rm -p 4873:4873 -d verdaccio/verdaccio:4.8.1
echo 'input some random username/password'
yarn npm login --publish
yarn npm publish
yarn npm logout --publish
echo 'open http://localhost:4873/-/web/detail/yarn-verdaccio-readme then you will see "ERROR: No README data found!".'

Expected behavior

README should be correctly shown on verdaccio

Screenshots

$ yarn npm publish
➤ YN0000: README.md
➤ YN0000: package.json
➤ YN0000: Package archive published
➤ YN0000: Done in 0.91s
image

Configuration File (cat ~/.config/verdaccio/config.yaml)

Default config in the verdaccio/verdaccio:4.8.1 docker image

Environment information

Server: the verdaccio/verdaccio:4.8.1 docker image Client: Yarn 2.1.1

Additional context

  • README.md is correctly uploaded
  • the issue seems to be that verdaccio depends on the readme field in the publish body to show the README content
  • the yarn 2 client does not provide the readme field in the publish body while npm did provide it, but the NPM registry seems to work fine without that field, for example the yarn 2 published @yarnpkg/libzip package shows the README correctly.
  • the corresponding yarn 2 issue: https://github.com/yarnpkg/berry/issues/1702

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
irudoycommented, Mar 3, 2022

Still actual for Verdaccio v5.6.2 and Yarn v3.2.0 😕

As a temporary workaround, I ended up manually adding the readme field with the contents of the README.md. It’s suitable for the CI environment, but you can do a cleanup in the postpack script if you need to. It’s dirty enough, hope this issue will be resolved someday.

package.json

"scripts": {
  "prepack": "node scripts/prepack.js"
},

scripts/prepack.js

const path = require('path')
const fs = require('fs')
const packagePath = path.resolve('./package.json')
const readmePath = path.resolve('./README.md')
const package = require(packagePath)
const readme = fs.readFileSync(readmePath, 'utf8')
package.readme = readme
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2))
2reactions
juanpicadocommented, Nov 26, 2020

I’ll ship it in the next minor release over the weekend 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

@verdaccio/readme | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Bountysource
README published by yarn 2 is not correctly shown on verdaccio.
Read more >
yarn | Verdaccio
yarn @1.x by default does not send the token on every request unless is ... yarn npm publish does not send README, read...
Read more >
Verdaccio - publish without being logged in? - Stack Overflow
But in a nutshell, npm@7 requires a token to publish, thus, is just a matter of fake a token to bypass npm. Verdaccio...
Read more >
How to test publishing your JavaScript package locally
Also, I'd like to see a kind of "preview" of how it'll look like when it's published, the "real" npm page, just to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found