Git Product home page Git Product logo

Comments (8)

rafbgarcia avatar rafbgarcia commented on July 28, 2024 3

@gshigeto it's not, I just managed to get it solved, the error message is REALLY bad, check it out:

Copy/paste of another response

For more info, see my answer here:
https://forum.ionicframework.com/t/issue-running-ionic-build-prod/120435/16

Apparently I can't export default class, this was the entire ******* issue.

My steps:

Step 1

Create a new ionic project and make check whether $ ionic build --prod works.

It did work.

Step 2

Try to make the build fail.

I achieved that creating a service and trying to use it in app.component.ts

import { Injectable } from '@angular/core'

@Injectable()
export default class Service {
  constructor() {}
}

Step 3

Try to make the build pass.

Updated my service to do an export class Service instead of export default class Service

import { Injectable } from '@angular/core'

@Injectable()
export class Service {
  constructor() {}
}

It passed.

Conclusion

Both errors were solved by that.

1- app.component.ts -> Can't resolve all parameters for MyApp [...]
2- app.module.ts -> Unexpected value 'null' declared by the module 'AppModule in [...]

from ionic-environment-variables.

gshigeto avatar gshigeto commented on July 28, 2024 1

Awesome! I am glad that you were able to get that figured out.

from ionic-environment-variables.

gshigeto avatar gshigeto commented on July 28, 2024

Could you provide a repo for this error?

from ionic-environment-variables.

rodriguesgm avatar rodriguesgm commented on July 28, 2024

@FanYeeChok I had the same error but it was related with some typescript error that I got in one of my dependency. After solving the typescript error, the build ran ok. So, probably, you need to solve that typescript error you have before running the build --prod. Try running build --dev and it'll problably fail too.
just my 2 cents...

from ionic-environment-variables.

FanYeeChok avatar FanYeeChok commented on July 28, 2024

@rodriguesgm Do you mind to share which dependency/typescript error cause the issue?

from ionic-environment-variables.

rafbgarcia avatar rafbgarcia commented on July 28, 2024

I'm having a similar issue, but it's all related to @ionic/app-scripts/dist/aot/aot-compiler.js.

Running app-scripts build: --prod
[22:24:46]  build prod started ...
[22:24:46]  clean started ...
[22:24:46]  clean finished in 1 ms
[22:24:46]  copy started ...
[22:24:46]  deeplinks started ...
[22:24:46]  deeplinks finished in 37 ms
[22:24:46]  ngc started ...
[22:24:49]  typescript error
            Can't resolve all parameters for MyApp in /Users/rafa/natal-food/imoto-motoboys/src/app/app.component.ts:
            ([object Object], [object Object], [object Object], ?).

Error: The Angular AoT build failed. See the issues above
    at /Users/rafa/natal-food/imoto-motoboys/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:237:55
    at step (/Users/rafa/natal-food/imoto-motoboys/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:32:23)
    at Object.next (/Users/rafa/natal-food/imoto-motoboys/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:13:53)
    at fulfilled (/Users/rafa/natal-food/imoto-motoboys/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:4:58)
    at <anonymous>
[22:24:49]  copy finished in 3.43 s

Does anyone know what this might be? Been trying to figure it out for 4 hours now 😞

from ionic-environment-variables.

rafbgarcia avatar rafbgarcia commented on July 28, 2024

Here is my $ ionic info fwiw:

cli packages: (/Users/rafa/.nvm/versions/node/v8.9.4/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    Node              : v8.9.4
    npm               : 5.6.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/rafa/Library/Android/sdk

Misc:

    backend : pro

from ionic-environment-variables.

gshigeto avatar gshigeto commented on July 28, 2024

@rafbgarcia, that seems like a dependency injection error in your app.component. You do not need to inject environments into components.

from ionic-environment-variables.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.