Build error on Dashboard - Cannot find Cordova Camera Module


#1

I have already read and tried the opened topic about the subject, but none of them solved my problem, so let me explain for you.
I am using the Cordova Camera Module, it works properly on real devices and there´s no error on browser testing, BUT, when dashboard presents error on the build part when i try to push my code to dashboard. Here´s the LOG

Using Shell executor...
Running on ip-10-2-39-0...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/c9648220/2/project-1'...
Checking out 25c1ff08 as master...
Skipping Git submodules setup
$ fetch-updates
Checking for build process updates...
$ build-app
Fetching build dependencies...
Running: npm install
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys

> 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
npm WARN ionic-angular@3.8.0 requires a peer of @angular/common@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/compiler@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/compiler-cli@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/core@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/forms@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/http@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/platform-browser@4.4.4 but none was installed.
npm WARN ionic-angular@3.8.0 requires a peer of @angular/platform-browser-dynamic@4.4.4 but none was installed.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 756 packages in 63.761s
npm install succeeded
Running: 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 fisioterapia@0.0.1~prebuild: fisioterapia@0.0.1
npm info lifecycle fisioterapia@0.0.1~build: fisioterapia@0.0.1

> fisioterapia@0.0.1 build /usr/src/app
> ionic-app-scripts build

[20:16:46]  ionic-app-scripts 3.0.1 
[20:16:46]  build dev started ... 
[20:16:46]  clean started ... 
[20:16:46]  clean finished in 2 ms 
[20:16:46]  copy started ... 
[20:16:46]  deeplinks started ... 
[20:16:46]  deeplinks finished in 80 ms 
[20:16:46]  transpile started ... 
[20:16:54]  typescript: src/app/app.module.ts, line: 14 
            Cannot find module '@ionic-native/camera'. 

      L13:  import { MetodoTresPage } from '../pages/metodo-tres/metodo-tres';
      L14:  import { Camera } from '@ionic-native/camera';

[20:16:54]  typescript: src/pages/fpi/fpi.ts, line: 3 
            Cannot find module '@ionic-native/camera'. 

       L2:  import { NavController, NavParams } from 'ionic-angular';
       L3:  import { Camera, CameraOptions} from '@ionic-native/camera';

[20:16:54]  ionic-app-script task: "build" 
[20:16:54]  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:106:82
    at 
npm info lifecycle fisioterapia@0.0.1~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fisioterapia@0.0.1 build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fisioterapia@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/2017-11-10T20_16_54_999Z-debug.log
npm run build failed
Make sure your project has a build script in the package.json
Running after script...
$ clean-up
Cleaning up files...
Successful clean up
ERROR: Job failed: exit status 1

Addional information: Here´s what returned what i ran npm install --save @ionic-native/camera

+-- UNMET DEPENDENCY @angular/core@4.4.3
+-- @ionic-native/camera@4.4.0
+-- UNMET DEPENDENCY @ionic-native/core@4.3.2
`-- UNMET DEPENDENCY rxjs@5.4.3

npm WARN @ionic-native/camera@4.4.0 requires a peer of @ionic-native/core@^4.2.0 but none was installe
npm WARN @ionic-native/camera@4.4.0 requires a peer of @angular/core@* but none was installed.
npm WARN @ionic-native/camera@4.4.0 requires a peer of rxjs@^5.0.1 but none was installed.

#2

Solved. I removed camera plugins and uninstalled it on node_modules

cordova plugin rm cordova-plugin-camera
npm uninstall --save @ionic-native/camera

Then i added plugin again and realized that the package.json was not being modified after npm install --save, so i modified and added dependencies on package.json and ran npm install adding dependencies, like this:

npm install --save @ionic-native/camera @angular/core@4.4.3 @ionic-native/core@4.3.2 rxjs@5.4.3 zone.js@0.8.18

Also, camera plugin was not being installed because it was requiring cordova android >= 6.3, so i ran:

cordova platform update android@6.3.0

and it solved my problem