Ionic 2 build faill

Hello,
I’m trying to build a my project. When i run

ionic build /

I get the following output.

node_modules/@angular/compiler-cli/src/private_import_compiler.js:10
[12:23:09] exports.AssetUrl = compiler_1.compiler_private.AssetUrl;
[12:23:09] TypeError: Cannot read property ‘AssetUrl’ of undefined
[12:23:09] ngc failed
[12:23:09] ionic-app-script task: “build”
[12:23:09] Error: Error

here is my package.json content:

“dependencies”: {
@angular/common”: “^2.0.0”,
@angular/compiler”: “^2.1.0”,
@angular/compiler-cli”: “^0.6.2”,
@angular/core”: “^2.1.0”,
@angular/forms”: “^2.0.0”,
@angular/http”: “^2.0.0”,
@angular/platform-browser”: “^2.0.0”,
@angular/platform-browser-dynamic”: “^2.0.0”,
@angular/platform-server”: “^2.1.0”,
@ionic/storage”: “^1.0.3”,
“angular2-google-map-auto-complete”: “^2.0.1”,
“ionic-angular”: “^2.0.0-rc.1”,
“ionic-native”: “^2.0.3”,
“ionicons”: “^3.0.0”,
“rxjs”: “^5.0.0-rc.1”,
“zone.js”: “^0.6.21”
},
“devDependencies”: {
@ionic/app-scripts”: “latest”,
“typescript”: “^2.0.3”
},
“description”: “occazstreetV2: An Ionic project”,
“cordovaPlugins”: [
“cordova-plugin-whitelist”,
“cordova-plugin-console”,
“cordova-plugin-device”,
“cordova-plugin-statusbar”,
“ionic-plugin-keyboard”,
“cordova-plugin-splashscreen”,
“cordova-plugin-x-socialsharing”
],
“cordovaPlatforms”: [
{
“platform”: “android”,
“version”: “”,
“locator”: “android”
}
]

can someOne help me to troubleshoot this error?

thks

Had the same issue when trying to build a project from scratch that built without error yesterday

Managed to fix this by explicitly pinning down dependencies to the versions I had in a working copy:

https://github.com/tkem/openlap/blob/master/package.json

See also Ionic 2 rollup git clone error namespace conflict

Fixed it for me, thank you

Okay, this worked for me too…
Just to confirm , I set as follows…

  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.1.0",
    "@angular/compiler": "2.1.0",
    "@angular/compiler-cli": "0.6.2",
    "@angular/core": "2.1.0",
    "@angular/forms": "2.1.0",
    "@angular/http": "2.1.0",
    "@angular/platform-browser": "2.1.0",
    "@angular/platform-browser-dynamic": "2.1.0",
    "@angular/platform-server": "2.1.0",
    "@ionic/storage": "1.0.3",
    "ionic-angular": "2.0.0-rc.1",
    "ionic-native": "2.2.3",
    "ionicons": "^3.0.0",
    "rxjs": "5.0.0-beta.12",
    "tsd": "0.6.5",
    "typings": "1.4.0",
    "underscore": "^1.8.3",
    "zone.js": "0.6.25"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.36",
    "typescript": "^2.0.3"
  },
  "cordovaPlugins": [

Thanks to all !

1 Like

nice! had same issue of seeing all the yellow text stating name space conflicts. Locking each version by removing carrot worked!

i still got error, bellow our configuration and error logs:

version :

npm 3.10.3
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1-201611031834
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X Yosemite
Node Version: v6.9.1
Xcode version: Xcode 7.2.1 Build version 7C1002

package.json

{
  "name": "bla-bla",
  "author": "blabla",
  "homepage": "http://blabla.com",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/common": "2.1.0",
    "@angular/compiler": "2.1.0",
    "@angular/compiler-cli": "0.6.2",
    "@angular/core": "2.1.0",
    "@angular/forms": "2.1.0",
    "@angular/http": "2.1.0",
    "@angular/platform-browser": "2.1.0",
    "@angular/platform-browser-dynamic": "2.1.0",
    "@angular/platform-server": "2.1.0",
    "@ionic/storage": "1.0.3",
    "ionic-angular": "2.0.0-rc.1",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.25"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.36",
    "typescript": "2.0.3"
  },
  "description": "Bla bla bla",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

logs

Names-MBP:blabla name$ ionic run android

Running 'run:before' npm script before run
> blabla@ build /Users/name/Documents/workspace/ionic/blabla
> ionic-app-scripts build
[10:21:10]  ionic-app-scripts 0.0.34 
[10:21:10]  build prod started ... 
[10:21:10]  clean started ... 
[10:21:10]  clean finished in 4 ms 
[10:21:10]  copy started ... 
[10:21:10]  ngc started ... 
[10:21:10]  copy finished in 32 ms 
[10:21:10]  lint started ... 
[10:21:11]  /Users/name/Documents/workspace/ionic/blabla/node_modules/@angular/compiler-cli/src/private_import_compiler.js:10 

[10:21:11]  exports.AssetUrl = compiler_1.__compiler_private__.AssetUrl; 

[10:21:11]  TypeError: Cannot read property 'AssetUrl' of undefined 

[10:21:11]  ngc failed 

[10:21:11]  ionic-app-script task: "build" 

[10:21:11]  Error: Error 



npm
 ERR! Darwin 14.5.0
npm ERR!
 argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR!
 node v6.9.1
npm ERR! npm 
 v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! blabla@ build: `ionic-app-scripts build`
npm ERR!
 Exit status 1
npm ERR! 

npm ERR! Failed at the blabla@ build script 'ionic-app-scripts build'.
npm ERR!
 Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the blabla package,
npm ERR!
 not with npm itself.
npm ERR! Tell the author that this fails on your system:

npm ERR!     ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs blabla
npm ERR! Or if that is not available, you can get their info via:
npm ERR!     npm owner ls blabla
npm ERR! There is likely additional logging output above.



npm ERR! Please include the following file with any support request:
npm ERR!     /Users/name/Documents/workspace/ionic/blabla/npm-debug.log

Caught exception:
 undefined 

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

[10:21:12]  lint finished in 1.26 s 
(node:833) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed