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?
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...
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