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.

[Bug] README is not correctly shown on verdaccio using `yarn npm publish`

See original GitHub issue

Describe the bug

README is not correctly shown on self-hosted verdaccio using yarn npm publish.

To Reproduce

(require docker to launch verdaccio so as to reproduce)

Reproduction
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
echo 'open http://localhost:4873/-/web/detail/yarn-verdaccio-readme then you will see "ERROR: No README data found!".'

Screenshots

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

Environment

  • Yarn version 2.1.1

Additional context

  • README.md is uploaded correctly.
  • No issue with npm publish.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
ikatyangcommented, Aug 16, 2020

I found the issue is that the readme field is missing in the publish body:

https://github.com/yarnpkg/berry/blob/bedc0cf6816d5090f812083a9f84fde77584800b/packages/plugin-npm-cli/sources/commands/npm/publish.ts#L164-L199

Adding the readme field can fix the issue:

 return {
+  readme: "# yarn-verdaccio-readme\n",
   _id: name, 
   _attachments: { 
image

I’m not sure if this should be fixed on the verdaccio side or the yarn side, but I’ll report this to the verdaccio repo as well.

0reactions
juanpicadocommented, Jan 6, 2022

Just a small notes from my side, pnpm had the same issue recently on v6 which was fixed a few weeks ago https://github.com/pnpm/pnpm/releases/tag/v6.24.1 https://github.com/pnpm/pnpm/pull/4117 . From verdaccio side, expects the body to contain a readme property with a string of the readme content. Also checking npm8 still sends the readme https://github.com/npm/read-package-json/blob/main/read-json.js#L295

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 >
npm ERR! 403 403 Forbidden npm publish - Stack Overflow
Probably there is already a package with the same name present on npm. Change package name in package.json and ...
Read more >
How to test publishing your JavaScript package locally
Since I've started using npm as a JS package manager (maybe back in ... it's published, the "real" npm page, just to see...
Read more >
to correct this please trying logging in again with: npm err ...
Try Deleting the package-lock.json file before running the command "npm install" after upgrading the node versions, if you have not done that.
Read more >
Best practices for creating a modern npm package - Snyk
In this tutorial, we're going to walk step by step through creating an npm package using modern best practices (as of 2022).
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