Comments (8)
@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.
Awesome! I am glad that you were able to get that figured out.
from ionic-environment-variables.
Could you provide a repo for this error?
from ionic-environment-variables.
@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.
@rodriguesgm Do you mind to share which dependency/typescript error cause the issue?
from ionic-environment-variables.
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.
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.
@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)
- How to use with Unit testing with Karma HOT 6
- Cannot find module '@app/env'. HOT 7
- Can not find '@app/env' when running 'ionic cordova build ios' HOT 8
- TypeError: Cannot read property 'resolve' of undefined HOT 4
- Environment folder outside Angular
- Custom environment other than IONIC_ENV, is not recognized as an internal or external command HOT 2
- How to ionic serve --prod? HOT 2
- using environment variables with live deploy HOT 1
- When I build with params MY_ENV=dev and --prod, ionic builds with the prod environment. HOT 3
- Everytime its load the last environment file
- Not working HOT 3
- Cannot find module ''@app/env" only at first run
- Loading environment variables when no `environment.XXX.ts` present
- Error: Cannot find module "@app/env" HOT 4
- Production env doesn't work with run livereload
- Updating env file with new attribute is not picked up by build or serve HOT 1
- No example in how to write the enviroment variable itself HOT 1
- Error: The Angular AoT build failed
- Building Ionic for Browser --
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ionic-environment-variables.