Skip to content

Commit 83807db

Browse files
fix: clarify the file name to be used (#1170)
As I was following the steps in this page - https://docs.npmjs.com/creating-node-js-modules, I noticed the following error when using the published package in the test-directory: `Error: Cannot find module 'D:\Learning\npm-docs\use-hello\node_modules\@andrewnessindev\hello\index.js'. Please verify that the package.json has a valid "main" entry` It turned out that I missed providing the main entry even though this [page already mentions to provide it](https://github.com/npm/documentation/blob/2e10e4ed46f0f58adf4c165e8ef21599bc3b325f/content/packages-and-modules/contributing-packages-to-the-registry/creating-node-js-modules.mdx?plain=1#L20). However, it might be more helpful if the docs clarify which file is referred to when[ it says, "In the file"](https://github.com/npm/documentation/blob/2e10e4ed46f0f58adf4c165e8ef21599bc3b325f/content/packages-and-modules/contributing-packages-to-the-registry/creating-node-js-modules.mdx?plain=1#L28). This is my first commit! I followed the instruction it the `contributing.md` file for the commit message. I did not see a requirement to raise an issue first! Please do let me know if I have to raise an issue first or if I have missed anything else. --------- Co-authored-by: Gar <wraithgar@github.com>
1 parent 2e10e4e commit 83807db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/packages-and-modules/contributing-packages-to-the-registry/creating-node-js-modules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ For more information on `package.json` files, see "[Creating a package.json file
2525

2626
## Create the file that will be loaded when your module is required by another application
2727

28-
In the file, add a function as a property of the `exports` object. This will make the function available to other code:
28+
Create a file with the same name you provided in the `main` field. In that file, add a function as a property of the `exports` object. This will make the function available to other code:
2929

3030
```
3131
exports.printMsg = function() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy