Generally when you browse a module on npm there is no node_modules
there. It's as far as I know an anti-pattern to upload your node_modules/
to npm. That's supposed to be created and populated by the client when they run npm install
.
For an example of this take the popular Node.js library, Ramda.
- Open https://www.npmjs.com/package/ramda?activeTab=explore
- Notice there
- is NOT a
node_modules/
directory - there is a
package.json
file there for the client that installs it.
- is NOT a
Now compare that to the upstream npm module
- Open https://www.npmjs.com/package/npm?activeTab=explore
- Notice there
- is a
node_modules/
directory - there is a
package.json
file there for the client that installs it.
- is a
Why does just npm ship the node_modules/
directory?
Follow up question "How do package.json's version numbers function when bundling a node_modules/ directory for your dependencies?"