Sonatype Nexus Repository Manager is often used as a proxy for npm packages on a corporate network. Whilst open source Ionic npm packages are obtained from the public repository at registry.npmjs.org, Enterprise Ionic packages such as Auth Connect, Identity Vault are require access to registry.ionicframework.com and require authentication.
This guide provides the necessary steps to create a proxy with Nexus for Ionic Enterprise Packages.
Create a Repository
Log in as an administrator to Sonatype Nexus Repository Manager
- Click Repositories -> Create repository
- Choose npm (proxy)
- Enter a name of Ionic Enterprise
- Under Proxy -> Remote storage enter: https://registry.ionicframework.com/
- Check HTTP -> Authentication and select Preemptive Bearer Token
- For the Token enter your Native Plugin Key can be found at https://dashboard.ionicframework.com/ (it begins with key_)
- Click Create repository
- Click the Copy button under the URL column. This URL is used when setting up your Ionic project
NOTE: An alternative to using a bearer token is using basic authentication with a username of your organization and password of your product key. The organization name is found by visiting https://dashboard.ionicframework.com and visiting the landing page of the organization then extracting the portion of the URL in between
Configure Your App
The normal process to configure a project to use the @ionic-enterprise packages and register your product key is to run:
> ionic enterprise register
This will setup a file called .npmrc. As we are using Nexus we'll create this file manually and add the contents:
In the above file replace [url-from-step8] with the URL for the repository you created.
Also replace key_xxx with your Native Plugin Key from the Ionic Dashboard.
Now any packages in your package.json that begin with @ionic-enterprise will be obtained from your Nexus repository rather than directly from Ionic's repository. To test this run:
> npm install
Important: Be sure to include the trailing slash (/) at the end of the URL in your .npmrc file.
Please sign in to leave a comment.