Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

IOS bundle failing #92

Closed
Jonatthu opened this issue Mar 2, 2017 · 21 comments
Closed

IOS bundle failing #92

Jonatthu opened this issue Mar 2, 2017 · 21 comments

Comments

@Jonatthu
Copy link

Jonatthu commented Mar 2, 2017

It is a fresh nativescript starter with 2.5 and angular using the hello-world template

bash-3.2$ cd nativescript
bash-3.2$ npm run start-ios-bundle

> @ start-ios-bundle /Users/jonatthu/Desktop/CrossPlaftform/nativescript
> npm run ns-bundle --ios --start-app


> @ ns-bundle /Users/jonatthu/Desktop/CrossPlaftform/nativescript
> ns-bundle

Running webpack for ios...
/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:14552
            var sourceFile = new SourceFileConstructor(261 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
                                                                                                            ^

TypeError: Cannot read property 'length' of undefined
    at createSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:14552:109)
    at parseSourceFileWorker (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:14484:26)
    at Object.parseSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:14433:26)
    at Object.createSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:14288:29)
    at WebpackCompilerHost.getSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/@ngtools/webpack/src/compiler_h
ost.js:209:27)
    at findSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63453:29)
    at processSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63384:27)
    at /Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63494:17
    at Object.forEach (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:1293:30)
    at processReferencedFiles (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63492:16)
    at findSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63477:21)
    at processSourceFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63384:27)
    at processRootFile (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:63271:13)
    at /Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:62620:60
    at Object.forEach (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:1293:30)
    at Object.createProgram (/Users/jonatthu/Desktop/CrossPlaftform/nativescript/node_modules/typescript/lib/typescript.js:62620:16)
child process exited with code 1

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "ns-bundle" "--ios" "--start-app"
npm ERR! node v6.10.0
npm ERR! npm  v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jonatthu/.npm/_logs/2017-03-02T06_15_33_872Z-debug.log

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start-ios-bundle"
npm ERR! node v6.10.0
npm ERR! npm  v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start-ios-bundle: `npm run ns-bundle --ios --start-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-ios-bundle script 'npm run ns-bundle --ios --start-app'.
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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run ns-bundle --ios --start-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jonatthu/.npm/_logs/2017-03-02T06_15_33_897Z-debug.log
@Jonatthu
Copy link
Author

Jonatthu commented Mar 2, 2017

If is useful my package.json is

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.nativescript",
    "tns-ios": {
      "version": "2.5.0"
    },
    "tns-android": {
      "version": "2.5.0"
    }
  },
  "dependencies": {
    "@angular/common": "2.4.3",
    "@angular/compiler": "2.4.3",
    "@angular/core": "2.4.3",
    "@angular/forms": "2.4.3",
    "@angular/http": "2.4.3",
    "@angular/platform-browser": "2.4.3",
    "@angular/platform-browser-dynamic": "2.4.3",
    "@angular/router": "3.4.3",
    "nativescript-angular": "1.4.0",
    "nativescript-dev-sass": "^0.4.2",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.0.1",
    "tns-core-modules": "2.5.0"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~2.4.3",
    "@ngtools/webpack": "1.2.10",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~3.0.1",
    "extract-text-webpack-plugin": "~2.0.0-beta.4",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.3.5",
    "nativescript-dev-webpack": "^0.3.5",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~1.6.0",
    "typescript": "~2.1.0",
    "webpack": "2.2.0",
    "webpack-sources": "~0.1.3",
    "zone.js": "~0.7.2"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 2, 2017

Hey @Jonatthu,

I'm sorry, I can't reproduce the problem. Can you describe exactly the steps you make - from creating the app to building it?

@devna13
Copy link

devna13 commented Mar 2, 2017

@sis0k0
I'm getting same error for both in ios & android
npm run ns-bundle --ios --start-app
npm run ns-bundle --android --start-app

nativescript@2.5.2
$npm -v
4.0.5
$node -v
v7.4.0

Running webpack for ios...


/Users/na/Workspaces/Git/test/node_modules/typescript/lib/typescript.js:14876
            var sourceFile = new SourceFileConstructor(263 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
                                                                                                            ^

TypeError: Cannot read property 'length' of undefined
    at createSourceFile (/Users/na/Workspaces/Git/test/node_modules/typescript/lib/typescript.js:14876:109)

{
    "tns-ios": {
      "version": "2.5.0"
    },
    "tns-android": {
      "version": "2.5.0"
    }
  },
  "scripts": {
    "tsc": "tsc",
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  },
  "dependencies": {
    "@angular/common": "^2.4.9",
    "@angular/compiler": "^2.4.9",
    "@angular/core": "^2.4.9",
    "@angular/forms": "^2.4.9",
    "@angular/http": "^2.4.9",
    "@angular/platform-browser": "^2.4.9",
    "@angular/platform-browser-dynamic": "^2.4.9",
    "@angular/router": "^3.4.9",
    "clone": "2.1.0",
    "email-validator": "1.0.7",
    "moment": "2.17.1",
    "nativescript-angular": "^1.4.1",
    "nativescript-appavailability": "^1.2.0",
    "nativescript-appversion": "1.3.3",
    "nativescript-clipboard": "^1.1.6",
    "nativescript-directions": "^1.0.5",
    "nativescript-fancyalert": "^1.1.2",
    "nativescript-iqkeyboardmanager": "1.0.1",
    "nativescript-local-notifications": "1.2.1",
    "nativescript-phone": "1.2.4",
    "nativescript-photoviewer": "^1.0.0",
    "nativescript-pulltorefresh": "1.1.10",
    "nativescript-timedatepicker": "^1.1.1",
    "reflect-metadata": "^0.1.10",
    "rxjs": "^5.2.0",
    "tns-core-modules": "2.5.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~2.4.3",
    "@ngtools/webpack": "^1.2.11",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "^6.16.1",
    "copy-webpack-plugin": "^4.0.1",
    "extract-text-webpack-plugin": "~2.0.0-beta.4",
    "filewalker": "0.1.3",
    "gulp": "^3.9.1",
    "gulp-clean": "^0.3.2",
    "gulp-clean-compiled-typescript": "^1.2.0",
    "gulp-replace": "^0.5.4",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-sass": "^0.4.2",
    "nativescript-dev-typescript": "^0.3.2",
    "nativescript-dev-webpack": "^0.3.5",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "^2.0.1",
    "tns-platform-declarations": "^2.5.0",
    "typescript": "^2.2.1",
    "webpack": "^2.2.1",
    "webpack-sources": "~0.1.3",
    "zone.js": "^0.7.7"
  }

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 2, 2017

@devna13 try deleting the platforms folder.

@devna13
Copy link

devna13 commented Mar 3, 2017

tried that.. getting same error

@Jonatthu
Copy link
Author

Jonatthu commented Mar 3, 2017

@sis0k0 The last thing worked for me thanks!

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 4, 2017

@devna13,
Can you log the name of the file that causes the error? I cannot check this right now, but I think that the typescript function createSourceFile (in node_modules/typescript/lib/typescript) accepts it as a parameter. Also you can try downgrading typescript to 2.1.

@devna13
Copy link

devna13 commented Mar 6, 2017

Thanks @sis0k0, I made the changes you mentioned
"typescript": "~2.1.0",

  0% compiling/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:73
        let extensionStartIndex = styleUrl.lastIndexOf(".");

What's that file? StyleUrlResolvePlugin

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 6, 2017

That's the plugin responsible for resolving platform-specific css files (randomComponent.android.css, etc.), specified from styleUrls in Angular components. More about it here: #47 .

Is that file related to your issue?

@devna13
Copy link

devna13 commented Mar 6, 2017

@sis0k0

I think so, I use SASS plugin and I have these files at the root:

_common.scss
platform.android.css
platform.ios.css
app.sass

in app.sass I only import dynamically generated css files


@import "./_common.scss";
@import url("~/platform.css"); 

if I comment out in webpack.common.js , it proceeds !
//new nsWebpack.StyleUrlResolvePlugin({platform}),

here is the output I get, which is failed to import @import url("~/platform.css"); into app.css, _common.scss got imported correctly


 10% building modules 0/3 modules 3 active ...Git/app/app/vendor.ts~~~ in typescript: /Users/me/Workspaces/Git/app/app/vendor.ts
 10% building modules 1/3 modules 2 active ...s/Git/app/app/main.ts~~~ in typescript: /Users/me/Workspaces/Git/app/app/main.ts
 10% building modules 3/9 modules 6 active ...tivescript-css-loader/lib/css-base.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/vendor-platform.ios.ts
 10% building modules 4/9 modules 5 active ...tivescript-css-loader/lib/css-base.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/app.module.ts
 10% building modules 5/10 modules 5 active ...e_modules/reflect-metadata/Reflect.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/utils/status-bar-util.ts
 10% building modules 6/10 modules 4 active ...e_modules/reflect-metadata/Reflect.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/shared/notification-helper.ts
 10% building modules 7/10 modules 3 active ...e_modules/reflect-metadata/Reflect.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/shared/healthkit-helper.ts
 12% building modules 23/28 modules 5 active ...pt-pulltorefresh/pulltorefresh.ios.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/shared/appSettings.ts
 12% building modules 24/28 modules 4 active ...pt-pulltorefresh/pulltorefresh.ios.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/shared/shared.ts
 13% building modules 25/53 modules 28 active ...ssors/selectedIndex-value-accessor.js~~~ in typescript: /Users/me/Workspaces/Git/app/app/models/dto.ts
Hash: eca6e47682de7d69aead
Version: webpack 2.2.1
Time: 10141ms
                     Asset       Size  Chunks                    Chunk Names
             img/Happy.png    8.32 kB          [emitted]
                 bundle.js    2.13 MB       0  [emitted]  [big]  bundle
                 vendor.js    3.61 MB       2  [emitted]  [big]  vendor
                   app.css    20.9 kB       1  [emitted]         app.css
 fonts/Paprika-Regular.ttf    42.3 kB          [emitted]
   fonts/Overlock-Bold.ttf    42.4 kB          [emitted]
fonts/Overlock-Regular.ttf    49.7 kB          [emitted]
     fonts/FontAwesome.otf     125 kB          [emitted]
         img/Depressed.png     8.9 kB          [emitted]
              img/Fine.png    8.16 kB          [emitted]
            img/Gloomy.png    8.35 kB          [emitted]
                app.css.js  268 bytes       1  [emitted]         app.css
           img/Extreme.png    9.43 kB          [emitted]
              img/Mild.png    8.21 kB          [emitted]
          img/Moderate.png    8.83 kB          [emitted]
       img/Melancholic.png    7.93 kB          [emitted]
            img/Severe.png    8.83 kB          [emitted]
                img/Ok.png    6.83 kB          [emitted]
        img/Unbearable.png    9.48 kB          [emitted]
              img/None.png     8.4 kB          [emitted]
              package.json   25 bytes          [emitted]
                starter.js   41 bytes          [emitted]
   [0] ../~/@angular/core/index.js 2.54 kB {2} [built]
  [11] ../~/tns-core-modules/platform/platform.ios.js 5.44 kB {2} [built]
 [507] ../~/nativescript-angular/forms.js 1.46 kB {2} [built]
 [508] ../~/nativescript-angular/platform-static.js 787 bytes {2} [built]
 [509] ../~/nativescript-angular/platform.js 1.87 kB {0} [built]
 [510] ../~/nativescript-angular/router.js 3.1 kB {2} [built]
 [511] ./app.module.ts 411 bytes {0} [built]
 [512] ./shared/healthkit-helper.ts 16.4 kB {0} [built]
 [513] ./shared/notification-helper.ts 3.12 kB {0} [built]
 [514] ./utils/status-bar-util.ts 1.43 kB {0} [built]
 [515] ./vendor-platform.ios.ts 61 bytes {2} [built]
 [750] ./app.css 41 bytes {1} [built]
 [751] ./main.ts 2.46 kB {0} [built]
 [752] ./vendor.ts 408 bytes {2} [built]
 [753] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 739 hidden modules

WARNING in ./app.css
  resolve-url-loader cannot operate: CSS error
  /Users/me/Workspaces/Git/app/app/app.css:8:4: property missing ':'
  at error (/Users/me/Workspaces/Git/app/node_modules/css/lib/parse/index.js:62:15)

ERROR in Error encountered resolving symbol values statically. Expression form not supported (position 25:15 in the original .ts file), resolving symbol ProfilePage in /Users/me/Workspaces/Git/app/app/pages/profile/profile.ts
Child extract-text-webpack-plugin:
       [0] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB {0} [built]
       [1] ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css 21.1 kB {0} [built] [1 warning]

    WARNING in ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css
      resolve-url-loader cannot operate: CSS error
      /Users/me/Workspaces/Git/app/app/app.css:8:4: property missing ':'
      at error (/Users/me/Workspaces/Git/app/node_modules/css/lib/parse/index.js:62:15)
child process exited with code 2

any suggestion how to resolve this ?

Thanks

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 6, 2017

Can you share the file pages/profile/profile.ts?

@devna13
Copy link

devna13 commented Mar 6, 2017

@sis0k0 Is this enough ? I only have "ProfilePage" string in export class ProfilePage

import { Component, Input, Output, OnInit, ElementRef, ViewChild, EventEmitter } from '@angular/core';
import { Router } from '@angular/router';
import { RouterExtensions } from 'nativescript-angular/router';

import { UserService } from '../../services/user.service';
import { View } from 'ui/core/view';
import * as Dto from '../../models/dto';
import { Util, Config, Url } from '../../shared/shared';
import imageSource = require("image-source");
import { Page } from 'ui/page';
import application = require('application');
import dialogs = require("ui/dialogs");

var PickerManager = require("nativescript-timedatepicker");
var gestures = require('ui/gestures');
var timer = require('timer');

let path = './profile';

/**

  • Profile Page
    */
    @component({ moduleId: module.id,
    selector: 'profile',
    templateUrl: ${path}.html,
    styleUrls: [${path}.css]
    })
    export class ProfilePage implements OnInit {

    isIos = application.ios;
    header = 'Profile';
    profilePic: imageSource.ImageSource;
    isLoading = true;
    isSaving = false;
    isSavingPic = false;
    isEdit = false;

    rightText = 'Edit';
    rightIcon = '';
    leftText = '';
    leftIcon = Util.MenuIcon;

    member: Dto.MemberViewModel;
    clonedMember: Dto.MemberViewModel;

    selectedText = '';
    toggleSideMenu = false;

    showChangePass = false;
    changePassModel = {
    oldPassword: null,
    newPassword: null,
    confNewPass: null
    }

    timeZones = [
    { label: 'Eastern Standard Time', checked: false },
    { label: 'Central Standard Time', checked: false },
    { label: 'Mountain Standard Time', checked: false },
    { label: 'US Mountain Standard Time', checked: false },//Arizona
    { label: 'Pacific Standard Time', checked: false }
    ];
    selectedTimeZone: any;

    homePhone: string;
    workPhone: string;
    skype: string;

    newDoNotDisturbStart: string = null;
    newDoNotDisturbEnd: string = null;
    showDoNotDisturb = false;
    private dateTimePickerFormat = 'DD MM yyyy HH:mm z';

    @ViewChild('scrollerElem') scrollerElem: ElementRef;
    @ViewChild('currentPassElem') currentPassElem: ElementRef;

    constructor(
    private _router: Router,
    private _userService: UserService,
    private _routerExtensions: RouterExtensions,
    private _page: Page) { }

    ngOnInit() {

     this.loadProfile();
    

    }

//some more code ....

}

@devna13
Copy link

devna13 commented Mar 6, 2017

if I uncomment

new nsWebpack.StyleUrlResolvePlugin({platform}),

this is the error I get: npm run ns-bundle --ios --start-app

~~~ in typescript: /Users/me/Workspaces/Git/app/node_modules/typescript/lib/lib.d.ts
  0% compiling/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:73
        let extensionStartIndex = styleUrl.lastIndexOf(".");
                                          ^

TypeError: Cannot read property 'lastIndexOf' of undefined
    at StyleUrlResolvePlugin.notPlatformUrl (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:73:43)
    at property.initializer.elements.filter.el (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:67:32)
    at Array.filter (native)
    at StyleUrlResolvePlugin.traversePropertyElements (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:67:14)
    at properties.filter.forEach.prop (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:58:35)
    at Array.forEach (native)
    at StyleUrlResolvePlugin.traverseProperties (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:58:14)
    at args.forEach.arg (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:53:52)
    at Array.forEach (native)
    at StyleUrlResolvePlugin.traverseDecoratorArguments (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:53:14)
    at node.decorators.forEach.decorator (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:48:18)
    at Array.forEach (native)
    at StyleUrlResolvePlugin.traverseDecorators (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:47:25)
    at ts.forEachChild.node (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:35:50)
    at visitEachNode (/Users/me/Workspaces/Git/app/node_modules/typescript/lib/typescript.js:13888:30)
    at Object.forEachChild (/Users/me/Workspaces/Git/app/node_modules/typescript/lib/typescript.js:14059:24)
    at StyleUrlResolvePlugin.usePlatformStyleUrl (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:35:12)
    at aotPlugin._program.getSourceFiles.forEach.sf (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:18:37)
    at Array.forEach (native)
    at Compiler.compiler.plugin (/Users/me/Workspaces/Git/app/node_modules/nativescript-dev-webpack/resource-resolver-plugins/StyleUrlResolvePlugin.js:18:18)
    at Compiler.applyPluginsParallel (/Users/me/Workspaces/Git/app/node_modules/tapable/lib/Tapable.js:229:14)
    at /Users/me/Workspaces/Git/app/node_modules/webpack/lib/Compiler.js:469:8
    at Compiler.applyPluginsAsyncSeries (/Users/me/Workspaces/Git/app/node_modules/tapable/lib/Tapable.js:131:46)
    at Compiler.compile (/Users/me/Workspaces/Git/app/node_modules/webpack/lib/Compiler.js:462:7)
    at /Users/me/Workspaces/Git/app/node_modules/webpack/lib/Compiler.js:220:10
    at Compiler.readRecords (/Users/me/Workspaces/Git/app/node_modules/webpack/lib/Compiler.js:372:10)
    at /Users/me/Workspaces/Git/app/node_modules/webpack/lib/Compiler.js:217:9
    at next (/Users/me/Workspaces/Git/app/node_modules/tapable/lib/Tapable.js:138:11)
    at Compiler.compiler.plugin (/Users/me/Workspaces/Git/app/node_modules/webpack/lib/CachePlugin.js:35:59)
    at Compiler.applyPluginsAsyncSeries (/Users/me/Workspaces/Git/app/node_modules/tapable/lib/Tapable.js:142:13)
child process exited with code 1

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 6, 2017

@devna13
For the first error:

ERROR in Error encountered resolving symbol values statically. Expression form not supported (position 25:15 in the original .ts file), resolving symbol ProfilePage in ...

You can't have dynamic values for the templateUrl and styleUrls properties. Consider replacing ${path} with a hard coded string.

The second error is caused by a problem in the plugin which we'll provide a fix for.

@devna13
Copy link

devna13 commented Mar 6, 2017

I made all the changes (I knew it's going to bite me somewhere!), and now bundle.js gets created but it fails to launch the app:

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00

Touch build/emulator/app.app
    cd /Users/me/Workspaces/Git/native-app/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/me/Workspaces/Git/native-app/node_modules/.bin:/usr/local/Cellar/android-sdk/24.4.1_1/tools:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools:/usr/local/lib/dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1/bin:/Users/me/.dnx/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Applications/Genymotion.app/Contents/MacOS:/usr/local/Cellar/android-sdk/24.4.1_1/tools:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools:/usr/local/lib/dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1/bin:/Users/me/.dnx/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Applications/Genymotion.app/Contents/MacOS/gmtool:/usr/local/Cellar/android-sdk/24.4.1_1/tools:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools:/usr/local/lib/dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1/bin:/Users/me/.dnx/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Applications/Genymotion Shell.app/Contents/MacOS/:/usr/local/Cellar/android-sdk/24.4.1_1/tools:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools:/usr/local/lib/dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1/bin:/Users/me/.dnx/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet"
    /usr/bin/touch -c /Users/me/Workspaces/Git/native-app/platforms/ios/build/emulator/app.app

** BUILD SUCCEEDED **

Project successfully built.
Installing...
Successfully installed on device with identifier 'C3EF9E34-AAD3-40AD-B15F-1D1382B079AC'.
Executing before-livesync hook from /Users/me/Workspaces/Git/native-app/hooks/before-livesync/nativescript-angular-sync.js
Transferring project files...
Successfully transferred all files.
Refreshing application...
Successfully synced application com.xyz.app on device C3EF9E34-AAD3-40AD-B15F-1D1382B079AC.

Mar  6 11:34:37 HEILAP66 backboardd[21259]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
Mar  6 11:34:37 HEILAP66 backboardd[21259]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
CONSOLE LOG file:///app/bundle.js:53465:16:

	 *** Application launchEvent:  Mon Mar 06 2017 11:34:38 GMT-0700 (MST)
SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=23338
CONSOLE LOG file:///app/bundle.js:45442:28: Error requestPermissions
CONSOLE LOG file:///app/bundle.js:53465:16:

	 *** Application resumeEvent:  Mon Mar 06 2017 11:34:38 GMT-0700 (MST)
SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=23338
Mar  6 11:34:38 HEILAP66 healthd[21250]: SecTaskLoadEntitlements failed error=22 cs_flags=200, task->pid_self=-1
CONSOLE LOG file:///app/bundle.js:45442:28: Error requestPermissions
CONSOLE LOG file:///app/bundle.js:53458:20: NativeScriptError: Error: No NgModule metadata found for 'AppModule'.
1   0x10a4107cb NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x10aae51ee ffi_closure_unix64_inner
3   0x10aae5b22 ffi_closure_unix64
4   0x10b72b958 -[UIViewController __viewWillAppear:]
5   0x10b76ac83 -[UINavigationController _startTransition:fromViewController:toViewController:]
6   0x10b76bc4d -[UINavigationController _startDeferredTransitionIfNeeded:]
7   0x10b76cd0b -[UINavigationController __viewWillLayoutSubviews]
8   0x10b91b503 -[UILayoutContainerView layoutSubviews]
9   0x10b645980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
10  0x10e267c00 -[CALayer layoutSublayers]
11  0x10e25c08e CA::Layer::layout_if_needed(CA::Transaction*)
12  0x10e25bf0c CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13  0x10e2503c9 CA::Context::commit_transaction(CA::Transaction*)
14  0x10e27e086 CA::Transaction::commit()
15  0x10e27e7f8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
16  0x10d8c9c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
17  0x10d8c9ba7 __CFRunLoopDoObservers
18  0x10d8bf11c CFRunLoopRunSpecific
19  0x10b585f21 -[UIApplication _run]
20  0x10b58af09 UIApplicationMain
21  0x10aae597d ffi_call_unix64
22  0x124063e90
file:///app/bundle.js:16663:170: JS ERROR Error: No NgModule metadata found for 'AppModule'.
Mar  6 11:34:38 HEILAP66 com.apple.CoreSimulator.SimDevice.C3EF9E34-AAD3-40AD-B15F-1D1382B079AC.launchd_sim[21242] (UIKitApplication:com.xyz.app[0x7aba][23338]): Service exited due to signal: Segmentation fault: 11
Mar  6 11:34:38 HEILAP66 SpringBoard[21258]: UNNotificationRegistrarConnectionListener connection invalidated

@sis0k0
Copy link
Contributor

sis0k0 commented Mar 6, 2017

Do you have a main.aot.ts file in which you are using the static nativescript-angular platform instead of the dynamic one?

@devna13
Copy link

devna13 commented Mar 6, 2017

missing: https://github.com/NativeScript/template-hello-world-ng/blob/release/main.aot.ts

still getting errors : rm -rf platforms/ && npm run ns-bundle --ios --start-app

1 0x1062fa33c -[TNSRuntime executeModule:referredBy:]
2 0x105de0549 main
3 0x10949a92d start
4 0x1
file:///app/bundle.js:7998:25: JS ERROR TypeError: Attempted to assign to readonly property.

which solved by adding "noEmitHelpers": true, to tsconfig.aot.json

@sis0k0 you are the best!

@devna13
Copy link

devna13 commented Mar 6, 2017

also had to change the order in webpack.common to fix css import

					test: /app\.css$/,
					loader: ExtractTextPlugin.extract([
						"nativescript-css-loader",
						"resolve-url-loader",
						"nativescript-dev-webpack/platform-css-loader",
					]),

@julienbiaussat
Copy link

same problem :
o TypeError: Cannot read property 'length' of undefined : at createSourceFile (C:_DATA\RENAULT\CADRAGE\GIT\Cadrage\node_modules\typescript\lib\typescript.js:14876:109)
I just played with environment.ts adding a baseURL :
export const env = {
production: false,
baseUrl: 'http://localhost:8080/api'
};
but the file was not found in my login service :
import { env } from '../environments/environment';
so I moved it one directory up to test, and it was ok
import { env } from '../environment';

I don't see relation with the bug ???

@julienbiaussat
Copy link

main.ts -> wrong path : import { environment } from './environments/environment';
because I moved environment.ts.... pfff

@jogboms
Copy link

jogboms commented Nov 18, 2017

For reference puposes, see this comment here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants