Ionic pro build fails module not found in app.module.ts but works fine in local


#1

Running with gitlab-ci-multi-runner 9.1.0 (0118d89)
on ip-10-2-95-244 (c9648220)
Using Shell executor…
Running on ip-10-2-95-244…
Cloning repository…
Cloning into ‘/home/gitlab-runner/builds/c9648220/1/project-1’…
Checking out 45a135ae as master…
Skipping Git submodules setup
$ run "fetch-updates"
Running Stage fetch-updates for Job: 5202242
Checking for build process updates…
$ run "build-app"
Running Stage build-app for Job: 5202242
Parsing ionic.config.json for project settings
Project Settings:
Name: demonew1
App ID: 38c6bbc2
Type: ionic-angular
$ npm install --quiet --no-optional

node-sass@4.5.3 install /usr/src/app/node_modules/node-sass
node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-57_binding.node
Download complete
Binary saved to /usr/src/app/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /home/gitlab-runner/.npm/node-sass/4.5.3/linux-x64-57_binding.node

uglifyjs-webpack-plugin@0.4.6 postinstall /usr/src/app/node_modules/uglifyjs-webpack-plugin
node lib/post_install.js

node-sass@4.5.3 postinstall /usr/src/app/node_modules/node-sass
node scripts/build.js

Binary found at /usr/src/app/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
added 580 packages in 33.524s
$ npm install --quiet --no-optional success
$ npm run build
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.2.1
npm info lifecycle demonew1@0.0.1~prebuild: demonew1@0.0.1
npm info lifecycle demonew1@0.0.1~build: demonew1@0.0.1

demonew1@0.0.1 build /usr/src/app
ionic-app-scripts build

[14:10:58] ionic-app-scripts 3.1.6
[14:10:58] build dev started …
[14:10:58] clean started …
[14:10:58] clean finished in 1 ms
[14:10:58] copy started …
[14:10:58] deeplinks started …
[14:10:58] deeplinks finished in 26 ms
[14:10:58] transpile started …
[14:11:01] typescript: src/app/app.module.ts, line: 10
Cannot find module ‘…/pages/guest/guest.module’.

   L9:  import { HomePage } from '../pages/home/home';

[14:11:01] typescript: src/pages/home/home.ts, line: 3
L10: import { GuestPageModule } from ‘…/pages/guest/guest.module’;

        Cannot find module '../guest/guest'. 

   L2:  import { NavController } from 'ionic-angular';
   L3:  import {GuestPage} from '../guest/guest'
   L4:  @Component({

[14:11:01] ionic-app-script task: “build”
[14:11:01] Error: Failed to transpile program
Error: Failed to transpile program
at new BuildError (/usr/src/app/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
at /usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:159:20
at Promise ()
at transpileWorker (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:107:12)
at Object.transpile (/usr/src/app/node_modules/@ionic/app-scripts/dist/transpile.js:64:12)
at /usr/src/app/node_modules/@ionic/app-scripts/dist/build.js:109:82
at
npm info lifecycle demonew1@0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demonew1@0.0.1 build: ionic-app-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demonew1@0.0.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/gitlab-runner/.npm/_logs/2018-01-02T14_11_02_013Z-debug.log
npm run build failed
Running after script…
$ run "clean-up"
Running Stage clean-up for Job: 5202242
ERROR: Job failed: exit status 1


#2

I had the same issue, I found this post; Ionic Pro: Issue when git push for building where a guy basically adds to package.json;

"build:local": "ionic-app-scripts build",
"build": "true",

Just to warn you, I raised a ticket for an assumedly unrelated error Ionic Support said (bizarrely) that "you have configured your app to not run a build when you push to Ionic Pro." and pointed at the above text but it builds fine, I just can’t package the damn thing in Pro.