Package readme is not being set, even though it exists in the directory. #31

Closed
OverZealous opened this Issue Feb 3, 2014 · 13 comments

Comments

Projects
None yet
6 participants

I'm moving this from npm/npm#4585 to here because I think the issue might be within read-package-json.


NOTE: The readme is showing up right now on this package do to the globOpts.sync hack I describe below.


I have an NPM package (gulp-cdnizer) that I'm working on. If I don't manually include the readme property in my package.json, then I get "ERROR: No README data found!" for the readme data.

I'm not doing anything funny with the .npmignore, and I don't actually understand how this is supposed to work. I've manually updated the readme on the previous packages I've published, but in researching this, I realized I shouldn't have to do this.

Hopefully you can help.

versions:

node: 0.10.25
npm:  1.3.25
read-package-json: 1.1.6

Since I originally wrote that, I've hacked around inside read-package-json, and I found that the readme function is getting called 4 times during npm publish. The first two (both in the original directory) successfully find a readme.

The second two (in some sort of deep temp directory, and under ~/.npm) both fail.

  • data.readme is not set

  • The dir variable is being set correctly.

  • Both of the failed directories do have a README.md file.

  • The README.md file exists before the glob call. Determined via:

    require('fs').existsSync(require('path').join(dir, 'README.md'))
  • When I directly run ls README?(.*) within those folder, the file is listed.

  • The file isn't coming through from the glob call at all (the files array is empty).

  • If I run glob synced, I get the correct file as a result:

    glob("README?(.*)", {cwd: dir, nocase: true, mark: true, sync: true})
  • Finally, if I simply add sync: true to globOpts, the readme is found and written correctly.

So, apparently it's an async issue?

@OverZealous - I tried the same workaround (adding sync: true to globOpts in read-json.js -> function readme(...)) and I can confirm it works for me as well.

Just thought I should mention it because there are other people facing the same issue.

Will you do a pull request?

I suppose, not sure if this is the right solution, but it's an easy PR to setup.

@OverZealous OverZealous added a commit to OverZealous/read-package-json that referenced this issue Feb 12, 2014

@OverZealous OverZealous Fix for inconsistent README file data, will close npm/read-package-js… 798f4c8

This bug still affects npm@1.4.2 :-(

Owner

isaacs commented Feb 17, 2014

It looks like the problem is because of the mark: true in the glob opts. Fix coming shortly.

This is a bug in glob that I haven't gotten around to fixing yet.

Thanks a lot for looking into it!

Great! Looking forward to the fix.

@boneskull boneskull pushed a commit to boneskull/karma-ng-server-side-template2js-preprocessor that referenced this issue Feb 24, 2014

Christopher Hiller bump for npm issue npm/read-package-json#31 0f76fb4

@icflorescu icflorescu added a commit to icflorescu/aspax-jade-handler that referenced this issue Feb 26, 2014

@icflorescu icflorescu Version bump
Again, I have to redeploy on NPM because of
[this](npm/read-package-json#31)…
047e93d

emirotin commented Mar 6, 2014

Recently hit me with npm 1.4.4 — now all the packages I recently republished shown "ERROR: No README data found!" on the npm site

Owner

isaacs commented Mar 12, 2014

Fixed in glob 3.2.9, just landed in npm. Will be in the next npm release.

isaacs closed this Mar 12, 2014

@isaacs I have a package that I can't raise the version as it is tightly coupled with another software, and is listed as "No README data found" node-webkit-builds. Any chance this can be fixed?

mpfdavis commented Jan 26, 2017 edited

This problem is back, my readme just disappeared from outputcache, when i try the above hack i get error - callback provided to sync glob. I'm using v7.4.0 (npm v4.0.5)

Hacked the function to be sync, I can see the file getting logged and in readme_ function, still doesn't appear on NPM.

  • ignore, appears NPM had an issue their side...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment