3

I seem to be missing a whole step in doing this. I added an .npmrc file in the root of my angular project and added the following line inside it:

@example/xxx:registry=ssh/url/of/my/private/repo/in/bitbucket

And accordingly added @example/xxx in my package.json to install the dependency from my private repository.

However, the file seems to have no effect at all and not even recognized as when running npm install fails and returns an error for not finding my package on npm registry (which was expected). Is there something more i have to do other than simply creating .npmrc file in the root of the project?

My goal us to be able to push the project with the correct configuration so that every who has access to the package and project repo can simply pull the project and be able to install and use the private package.

ilpianoforte
  • 1,180
  • 1
  • 10
  • 28

1 Answers1

1

Adding the following line in package.json of the angular project solves the problem:

"package-name": "url/of/package/repo"

But, I want to change the package scope and to be able to address it using @SCOPE/xxx:registry=......

*Its a private package and it is not published.

Edit: I simply had a typo. The following line in the .npmrc file worked:

@SCOPE:registry=https://....

The xxx part was not needed. Thanks to the gitlab package registry documentation.

ilpianoforte
  • 1,180
  • 1
  • 10
  • 28
  • Do you have the scope defined in your private package as well? In that package.json the name property should look like this: "name": "@SCOPE/package-name" – west efan Aug 20 '21 at 07:42
  • 1
    @westefan, I have not. to be more precise, i dont know how/where to. – ilpianoforte Aug 20 '21 at 07:50
  • In your private package that you want to install there is also a package.json. In there the name attribut should also define the scope as mentioned above. – west efan Aug 20 '21 at 08:18
  • 1
    Yep i did it, but still no change. In my opinion the problem is that the `.npmrc` file in the angular project is not recognized at all as npm looks for the package at `https://registry.npmjs.org/`. Is there something specific i need to do beside creating a simple file name as `.npmrc`? – ilpianoforte Aug 20 '21 at 08:48