I npm publish
'd a module. It went up fine, but then when I installed it from the registry, it turned out to be missing certain files.
When I run irish-pub in my module's project directory, sure enough, the output doesn't list those filenames.
I've checked:
.npmignore
file..gitignore
but this only contains /node_modules/
What else could be blocking them?
When you run npm publish , npm bundles up all the files in the current directory. It makes a few decisions for you about what to include and what to ignore. To make these decisions, it uses the contents of several files in your project directory.
In simpler terms, npm prefers the . npmignore file if it is there, but will fall back to the . gitignore file. In many cases, both Git and npm can ignore the same files, so it makes sense to just use a .
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a scope in the name (see package. json ).
The problem was I had a files
array in package.json. If this is present, then only the specified files get published, and everything else is effectively npmignored.
https://docs.npmjs.com/files/package.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With