1

I have created a private module in node and published it to the nexus repository. The private module is using 'cryptr' module for encryption. When I install the private module to my application and try to access methods inside it, getting an exception as module 'cryptr' is not found. The cryptr module is not directly referring to my application. It is used in the private module that is installed in the application.

How to avoid installing dependencies by referring to the private module again in the application which is using the private module.

package.json for the private module

{
  "name": "@app/private1",
  "version": "0.0.1",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "cryptr": "6.0.3"
  },
  "publishConfig": {
    "registry": "https://nexus.test.com/repository/repo/"
  }
}
Sadeed_pv
  • 513
  • 1
  • 9
  • 22
  • 1
    if you have it as a `devDependency` it won't install when installed in other apps. If it's a runtime dependency, it should be a `dependency` – Joe Aug 08 '22 at 14:33
  • I tried adding the dependency as "dependency": { "cryptr": "6.0.3" }, still facing the same error. – shyama moneymohan Aug 09 '22 at 09:23
  • This issue is resolved by adding "bundleDependencies": [ "cryptr", "properties-reader" ], This will bundle all the dependencies while publishing it to nexus repository. – shyama moneymohan Aug 10 '22 at 07:08
  • new package.json { "name": "custom1", "version": "0.0.13", "description": "", "main": "app.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "cryptr": "^6.0.3", "properties-reader": "^2.2.0" }, "bundleDependencies": [ "cryptr", "properties-reader" ], "publishConfig": { "registry": "https://nexus.test.com/repository/testRepo/" } } – shyama moneymohan Aug 10 '22 at 07:09

0 Answers0