npm-publish-index-test v0.3.0
npm-publish-index-test
npm publish test repository
Issue: npm#12498 → npm#5082 Status: Identified
Problem
When I upgraded to Node 6, it came shipped with npm@3.8.6
. I released new versions from some packages and after using those packages, my index.js
file was not published. At first I thought that it only affected me, "I must have done something wrong!". But it appeared that
Sindre Sorhus released his array-differ package after installing
Node 6 and suffered from the same bug.
In the following case, the bug always occurs.
- Add
index.js
to the files property inpackage.json
- Have
node_modules
directory with your dependencies - Have a
.gitignore
file which ignores thenode_modules
directory
Why
The improved performance of
fs.realpath
has changed the timing and order of operations enough that it greatly exacerbates the race condition.
So probably something goes wrong because Node 6 improved the performance of fs.realpath
.
Test
Go to your module directory and run the following command
$ npm pack
This will generate a tarball just like the one that will be published. So extract the contents and take a look if some files are missing.
Solution
You have two options
- Downgrade
npm
tonpm@2
and republish your package! - Remove the
node_modules
directory first before publishing
I can't say 100% for sure that option 2 always works. You can always test with npm pack
before publishing.