Packages distributed in the github registry cannot be installed

28 Views Asked by At

I created and published package which depends on the typeorm package, to the github registry.

The deployment was successful, but when I try install the package, I got a message:

“Package not found.” cause npm try to  install my package's dependency from "npm.pkg.github.com".

I want to allow only dependent packages to be installed from registry.npmjs.com. What should I do?

I tried this command,

 npm install @narumir/[email protected] --registry https://npm.pkg.github.com 

and I got this error.

install package error

1

There are 1 best solutions below

1
ADITYA On

You can specify the registry in your package.json file or in your npm configuration.

{
  "name": "your-package-name",
  "version": "1.0.0",
  "dependencies": {
    "typeorm": "version",
    // Other dependencies
  },
  "publishConfig": {
    "registry": "https://registry.npmjs.com/"
  }
}

Alternatively, you can set the registry globally using npm CLI:

npm config set registry https://registry.npmjs.com/