Ionic Pro: build npm err with our own private hosted package dependencie


#1

Hi everyone,

We have one of our package dependencie hosted on our private repository (in package.json, access like git+ssh://git@ip:port/path_to_package.git, using a ssh key to authenticate in our development environnement).

When we push to inic master, the automatic build on ionicpro failed because it can’t access to our private repository server:

$ build-app
Fetching build dependencies...
Running: npm install
npm WARN deprecated babili@0.1.2: babili has been renamed to babel-minify. Please update to babel-minify
npm WARN deprecated babel-preset-babili@0.1.4: babili has been renamed to babel-minify. Please update to babel-preset-minify
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git+ssh://git@ip:port/path_to_package.git
...
npm install failed
Failed to upload build to storage please retry your build.

Is there any solutions to correct this, without making public our package ?

Thanks for your help


#2

I am struggling with this as well. Does anybody know about any solution for this?


#3

Ionic Pro is a hosted and closed source service, so there is not much we, the community, can help you with, sorry. Check these:

You can - and should - contact support at http://ionicframework.com/support#support


#4

Hi @ecoledirecte. Did you find solution?


#5

Hi,

yes, finally we make a npm pack from our private module. Then we put the .tgz generated in our app, on git too.
In package.json dependencies section, we do a link with file:....tgz to our package.


#6

@ildar @ecoledirecte

npm pack will work great unless your upgrading the version of the npm private modules.

you might want to try adding to the .gitignore a line like !node_modules/@yourScope/** that way you check the private node module into ionic


#7

I have created tgz file but now how to use that node module in our IONIC application? Node module is installed successfully but how to use that in .ts file?


#9

The package in “tgz” format is my core library. I build it based on this project : https://github.com/robisim74/angular-library-starter
So, to make a new release, i start with the “build” npm command, then i make a npm pack ./dist to generate the “tgz” file, which i copy into my ionic project.

in my ionic project, i just import anything needed like this: import {...} from '@mylibrary/core'
=> https://github.com/robisim74/angular-library-starter#rollup-or-webpack


#10

59%20PM
My plugin structure is like this and I have created tgz using command npm pack. My plugin name is :cordova-plugin-ews-barcodescanner. But I am not able to use in my project its giving me error below:

Module not found: Error: Can't resolve 'cordova-plugin-ews-barcodescanner' in '/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/src/pages/assoc-registration/assoc-registration'
resolve 'cordova-plugin-ews-barcodescanner' in '/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/src/pages/assoc-registration/assoc-registration'
  Parsed request is a module
  using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/package.json (relative path: ./src/pages/assoc-registration/assoc-registration)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/package.json (relative path: ./src/pages/assoc-registration/assoc-registration)
    resolve as module
      looking for modules in /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules
        using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/package.json (relative path: ./node_modules)
          using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/package.json (relative path: .)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner is not a file
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.js doesn't exist
            .json
              Field 'browser' doesn't contain a valid alias configuration
              /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.json doesn't exist
            as directory
              existing directory
                using path: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index
                  using description file: /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/package.json (relative path: ./index)
                    no extension
                      Field 'browser' doesn't contain a valid alias configuration
                      /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index doesn't exist
                    .ts
                      Field 'browser' doesn't contain a valid alias configuration
                      /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.ts doesn't exist
                    .js
                      Field 'browser' doesn't contain a valid alias configuration
                      /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.js doesn't exist
                    .json
                      Field 'browser' doesn't contain a valid alias configuration
                      /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.json doesn't exist
       Field 'browser' doesn't contain a valid alias configuration
                      /Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.json doesn't exist
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.ts]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.js]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner.json]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.ts]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.js]
[/Users/pooja.shah/Pooja/Projects/Kiosk_Mode/ews-locator-mobileapp/EyewitnessLocator/node_modules/cordova-plugin-ews-barcodescanner/index.json]
 @ ./src/pages/assoc-registration/assoc-registration/assoc-registration.ts 37:0-66
 @ ./src/pages/assoc-registration/assoc-registration/assoc-registration.module.ts
 @ ./src lazy
 @ ./node_modules/ionic-angular/util/ng-module-loader.js
 @ ./node_modules/ionic-angular/module.js
 @ ./node_modules/ionic-angular/index.js
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts,./src/pages/assoc-registration/assoc-registration/assoc-registration.ts

#11

We’ve solved it by adding a dedicated user ‘ionic’ to our self-hosted GitLab instance.

This user has been marked as external (external users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects or groups).

We’ve then added the ‘ionic’ user with “Reporter” rights to the relevant repositories.

In the package.json, the dependency is then given as:

“package_name”: “git+https://ionic:password_for_ionic_user@ip:port/path_to_package.git”

It’s not ideal, but works.


#12

I was trying to setup a ionic pro live update for a mobile app which has a dependency module that is in our internal repository. I can configure the firewall to so it allows ionic pro build servers to access the repo but I could not find any reference to the Ionic Pro build server IP(s). My plan is to add a npm config registry to point to my repo in the preinstall script target in package.json of the mobile app. Does anyone know of a reference?


#13

This doesn’t seem to work with ionic build server. Looks like they remove node_modules folder before running npm install command. Just want to try copying the module to another folder /usr/src/app before running npm install (adding mv script to preinstall script in package.json) and copy them back after npm install (adding another mv to postinstall script in package.json) to avoid the module getting deleted.


#14

Some useful suggestions here.
https://ionic.zendesk.com/hc/en-us/requests/14446