Aakash Ratkal
Aakash Ratkal

Reputation: 1

Unable to publish dependencies into private npm repository

I have created a private nexus repository to host my custom nodejs libraries. But when I publish my package, it doesn't publish any of its dependencies.

Steps:

npm set registry <registry url>
npm login
npm publish

package.json

{
  "name": "testpackage",
  "version": "1.0.0",
  "private": false,
  "dependencies": {
    "request": "^2.87.0",
    "safe-access": "0.1.0",
    "winston": "^2.4.2"
  },
  "main": "index.js",
  "directories": {
    "test": "tests"
  },
  "devDependencies": {},
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}

I get this issue when I try to install my package

npm install testpackage
npm ERR! code E404
npm ERR! 404 Not Found: [email protected]
npm ERR! A complete log of this run can be found in:
npm ERR! /<path>/.npm/_logs/2018-10-04T11_25_36_719Z-debug.log

Is there a way to publish node_modules/all transitive dependencies into nexus? (Note: I will not be having internet access in production environment. Hence I need to download all dependencies from private repo itself)

Upvotes: 0

Views: 1334

Answers (2)

Aakash Ratkal
Aakash Ratkal

Reputation: 1

I have solved the issue as follows:

I used a npm-group repository and added a npm-hosted repository and a cache enabled npm-proxy (Only this repository has internet access). Steps to add new packages to the repository:

1) Add the repo to a dummy package.json
2) npm install. (All the required packages get cached)
3) I point proxy-url to some junk url. (To avoid unwanted code to come into my environment).

Steps to use the repository:
1) npm set registry [npm-group-repo url]
2) npm install

Upvotes: 0

joedragons
joedragons

Reputation: 2645

No.

What you're describing is exactly what Nexus Repository Manager designed groups for but your internetless scenario removes that from the equation. Your only recourse is manual upload.

Upvotes: 1

Related Questions