andrew oxenburgh
andrew oxenburgh

Reputation: 136

npm private module not finding module

I have just started using npm private modules, and cannot pick up the module in my code.

The module is up and running on npmjs, I can install it correctly, but my require statement is failing.

My username has a dot in it.

I'm running os-x.

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

I am doing an npm i --save @user.name/my-module-name, which is setting the package.json correctly, with current versions and so on, and pulling the module into my ./node_modules dir.

Error here: When I do the require('@user.name/my-module-name') however, I'm getting a Cannot find module error.

I have tried escaping parts of the name, and addressing it directly, to no avail. This feels like a node problem.

How can I pick up the module from code?

Upvotes: 5

Views: 1992

Answers (1)

andrew oxenburgh
andrew oxenburgh

Reputation: 136

To answer my own question, set the package.json::main property to the relevant file:

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

It was finding the module, but not the code...

Upvotes: 2

Related Questions