ionic-audio icon indicating copy to clipboard operation
ionic-audio copied to clipboard

Prod compiler error

Open dkirolos opened this issue 9 years ago • 15 comments

Ionic-audio version: [ X] 2.3.4

I'm submitting a ... [ X] bug report (probably but not sure if there is any workaround to solve this)

Current behavior:

When trying to compile using "ionic build --prod" I get the following error:

[12:33:56] ionic-app-scripts 1.1.4 [12:33:56] build prod started ... [12:33:56] clean started ... [12:33:56] clean finished in less than 1 ms [12:33:56] copy started ... [12:33:56] ngc started ... [12:34:01] build prod failed: Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts [12:34:01] ionic-app-script task: "build" [12:34:01] Error: Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts Error: Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a r eference to an exported function, resolving symbol Injectable in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/metadata.d.ts, re solving symbol OpaqueToken in /Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in / Users/david/Documents/ionic/RolFinal/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts at SyntaxError.BaseError [as constructor] (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:1597:31) at new SyntaxError (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:1795:20) at simplifyInContext (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:25783:27) at StaticReflector.simplify (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:25795:17) at StaticReflector.annotations (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:25291:64) at NgModuleResolver.resolve (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:17771:86) at CompileMetadataResolver.getNgModuleMetadata (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:18272:64) at addNgModule (/Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:25053:62) at /Users/david/Documents/ionic/RolFinal/node_modules/@angular/compiler/bundles/compiler.umd.js:25064:18

Expected behavior:

An application compiled with Prod

Steps to reproduce:

Just execute: ionic build --prod

This is not happening when using ionic build --dev

The same issue happen with AoT

Ionic info:

Cordova CLI: 6.5.0 Ionic Framework Version: 2.2.0 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.1.4 ios-deploy version: 1.9.0 ios-sim version: 5.0.12 OS: macOS Sierra Node Version: v6.3.0 Xcode version: Xcode 8.2.1 Build version 8C1002

Thanks man for this amazing plugin!

dkirolos avatar Mar 19 '17 16:03 dkirolos

@davidkirolos please see #94 . Brief explanation: [email protected] requires [email protected] while building with --prod

@sfaizanh @arielfaur : Setting ionic-audio to a fixed ionic version could be a nightmare. My thoughts

  • Is there a way to make this project version-independant? (Something like >= 2.0 and <=2.2.1 )
  • Maybe the demo application should be placed on a separated repository to avoid this problems?

borodiliz avatar Mar 22 '17 13:03 borodiliz

@borodiliz I solved this issue by not using the npm package, I copied the source code from GitHub to the application directly. And now it's compiling with --prod --aot .

dkirolos avatar Mar 22 '17 21:03 dkirolos

@borodiliz i'll look into it. Ionic released ionic 2.3.0 with ionic native 3

@davidkirolos can reproduce the step you took and paste over here Thanks

sfaizanh avatar Mar 24 '17 01:03 sfaizanh

@davidkirolos the very simple solution was to change your package.json entry to point to this repo instead of the npm package.

"ionic-audio": "git+https://github.com/sfaizanh/ionic-audio.git#2.0",

codinronan avatar Mar 29 '17 07:03 codinronan

Thanks @codinronan for helping @davidkirolos but i'm waiting for @arielfaur for merge so that everyone can install from NPM, but for temporary solution good to go with my fork repo

sfaizanh avatar Mar 29 '17 08:03 sfaizanh

I'm having the same problem but changing the package.json entry in my app doesn't solve it :(

eljuani avatar Mar 29 '17 09:03 eljuani

Please describe your issue over here #102 so that it can logged in that PR

  1. What errors are you getting
  2. Can you show us your package.json
  3. Share app.modules.ts imports array imports: []; // for lambda functions

sfaizanh avatar Mar 29 '17 09:03 sfaizanh

@eljuani May be you didn't follow these instructions https://github.com/arielfaur/ionic-audio/pull/102#issuecomment-288905820

Don't remove the node_modules just remove node_modules/ionic-audio

sfaizanh avatar Mar 29 '17 09:03 sfaizanh

Hi, I didnt know about the instructions but I just followed them and it's the same, maybe I did something wrong. ERRORS: Error: Error encountered resolving symbol values statically. Calling function 'makeParamDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts Error: Error encountered resolving symbol values statically. Calling function 'makeParamDecorator', function calls are not supported. Consi der replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/juan/Desktop/audioguia /ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/juan/Desk top/audioguia/ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/ionic-audio/node_modules/@angular/core/src/di/opaque_token.d.ts at SyntaxError.BaseError [as constructor] (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compile r.umd.js:1597:31) at new SyntaxError (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:1795:20) at simplifyInContext (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:25783:27) at StaticReflector.simplify (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:25795 :17) at StaticReflector.annotations (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:25 291:64) at NgModuleResolver.resolve (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:17771:86) at CompileMetadataResolver.getNgModuleMetadata (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/co mpiler.umd.js:18272:64) at addNgModule (/Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:25053:62) at /Users/juan/Desktop/audioguia/ionic2-tutorial/node_modules/@angular/compiler/bundles/compiler.umd.js:25064:18 at Array.forEach (native) PACKAGE.JSON (the original one, without changing "ionic-audio"): { "name": "ionic-hello-world", "author": "Ionic Framework", "homepage": "http://ionicframework.com/", "private": true, "scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" }, "dependencies": { "@angular/common": "2.4.8", "@angular/compiler": "2.4.8", "@angular/compiler-cli": "2.4.8", "@angular/core": "2.4.8", "@angular/forms": "2.4.8", "@angular/http": "2.4.8", "@angular/platform-browser": "2.4.8", "@angular/platform-browser-dynamic": "2.4.8", "@angular/platform-server": "2.4.8", "@ionic-native/core": "3.1.0", "@ionic-native/splash-screen": "3.1.0", "@ionic-native/status-bar": "3.1.0", "@ionic/storage": "2.0.0", "ionic-angular": "2.3.0", "ionic-audio": "^2.3.4", "ionicons": "3.0.0", "ng2-translate": "^5.0.0", "rxjs": "5.0.1", "sw-toolbox": "3.4.0", "zone.js": "0.7.2" }, "devDependencies": { "@ionic/app-scripts": "1.2.2", "typescript": "2.0.9" }, "cordovaPlugins": [ "cordova-plugin-splashscreen", "cordova-plugin-whitelist", "cordova-plugin-device", "ionic-plugin-keyboard", "cordova-plugin-statusbar", "cordova-plugin-console" ], "cordovaPlatforms": [ "ios", { "platform": "ios", "version": "", "locator": "ios" } ], "description": "ionic2-tutorial: An Ionic project" } APP.MODULES.TS imports array: imports: [ IonicModule.forRoot(MyApp), IonicAudioModule.forRoot(), TranslateModule.forRoot({ provide: TranslateLoader, useFactory: translateLoaderFactory, deps: [Http] })

Thx !

eljuani avatar Mar 29 '17 18:03 eljuani

@eljuani

import { IonicAudioModule, AudioProvider, WebAudioProvider } from 'ionic-audio';

Replace your imports in app.modules.ts

imports: [
    IonicModule.forRoot(MyApp),
    IonicAudioModule.forRoot({ provide: AudioProvider, useFactory: myAudioProviderFactory }),
    TranslateModule.forRoot({
        provide: TranslateLoader,
        useFactory: translateLoaderFactory,
        deps: [Http]
    })
]

Add This at the end of the file app.modules.ts

export function myAudioProviderFactory() {
  return new WebAudioProvider();
}

Try rebuilding app with --prod flag

sfaizanh avatar Mar 29 '17 19:03 sfaizanh

Added that. Still the same. But now if I replace the "ionic-audio": in my package.json app for "git+https://github.com/sfaizanh/ionic-audio.git#2.0" and do a nmp install -dd "ionic-audio" --save it fails: npm verb cli 'ionic-audio', npm verb cli '--save' ] npm info using [email protected] npm info using [email protected] npm verb cache add spec ionic-audio@git+https://github.com/sfaizanh/ionic-audio.git#2.0 npm verb addRemoteGit caching git+https://github.com/sfaizanh/ionic-audio.git#2.0 npm verb addRemoteGit git+https://github.com/sfaizanh/ionic-audio.git#2.0 is a repository hosted by github npm verb tryClone git-https-github-com-sfaizanh-ionic-audio-git-2-0-a8d13111 not in flight; caching npm verb correctMkdir /Users/juan/.npm/_git-remotes correctMkdir not in flight; initializing npm info git [ 'clone', npm info git '--template=/Users/juan/.npm/_git-remotes/_templates', npm info git '--mirror', npm info git 'https://github.com/sfaizanh/ionic-audio.git', npm info git '/Users/juan/.npm/_git-remotes/git-https-github-com-sfaizanh-ionic-audio-git-2-0-a8d13111' ]

It hangs after the last line

EDIT: NOW I WAS ABLE TO INSTALL IT. But the same problem persists.

eljuani avatar Mar 29 '17 19:03 eljuani

@eljuani

  1. Download https://github.com/sfaizanh/ionic-audio/archive/2.0.zip
  2. Extract it rename the folder to ionic-audio and copy folder
  3. Go to Project/node_modules
  4. Remove ionic-audio folder if exists
  5. Paste it.
  6. In Terminal cd ~/Desktop/audioguia/ionic2-tutorial/node_modules/ionic-audio
  7. npm run prepublish

Now try to build again

sfaizanh avatar Mar 29 '17 19:03 sfaizanh

@sfaizanh That did it ! :)

eljuani avatar Mar 29 '17 20:03 eljuani

I just upgraded the module to Ionic 3. It should work by simply removing and adding the module back again npm install [email protected]

arielfaur avatar Apr 17 '17 18:04 arielfaur

Is this all good now? Can we close this issue?

tbergeron avatar May 30 '17 16:05 tbergeron