Npm private module not finding module

I just started using private npm modules and cannot select a module in my code.

The module works and works on npmjs, I can install it correctly, but my require statement fails.

My username has a period.

I am running os-x.

So module @user.name/my-module-name.

I am doing npm i --save @user.name/my-module-namethat correctly installs package.json with current versions, etc. and pulls out the module into mine. / node_modules dir.

Error here: However, when I do require('@user.name/my-module-name'), I get an error Cannot find module.

I tried to slip away parts of the name and turn to it directly, but to no avail. This seems like a node problem.

How can I get a module from code?

+4
source share
1 answer

To answer my own question, set the package.json :: main property for it:

"main": "./src/largestHref.js"

He found a module, but not code ...

+1
source

All Articles