Skip to content

Run demo examples #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gpfiel opened this issue Aug 17, 2017 · 14 comments
Closed

Run demo examples #65

gpfiel opened this issue Aug 17, 2017 · 14 comments
Labels

Comments

@gpfiel
Copy link

gpfiel commented Aug 17, 2017

Hi,

I am trying to run the "tns run ios" for both demos I am having the same problem for both:

Project successfully built.
Installing...
Successfully installed on device with identifier 'D7FF528C-C525-4DB2-8264-1E2BB88D8F3A'.
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.demo on device D7FF528C-C525-4DB2-8264-1E2BB88D8F3A.
Executing before-watch hook from /Library/WebServer/Documents/nativescript-facebook/demo/hooks/before-watch/nativescript-dev-typescript.js
Found peer TypeScript 2.2.2
objc[26573]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x119ebccc0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x119cd36f0). One of the two will be used. Which one is undefined.
17:20:55 - Compilation complete. Watching for file changes.



1   0x109bd629c -[TNSRuntime executeModule:referredBy:]
2   0x1095a3eb0 main
3   0x10e54765d start
file:///app/app.js:5:38: JS ERROR Error: Could not find module 'nativescript-facebook'. Computed path '/Users/fiel/Library/Developer/CoreSimulator/Devices/D7FF528C-C525-4DB2-8264-1E2BB88D8F3A/data/Containers/Bundle/Application/F503F1DA-61DF-4369-BFB1-F5BEA5E0F495/demo.app/app/tns_modules/nativescript-facebook'.

I tried to run "tns plugin add nativescript-facebook" but it shows me a message "It is already installed"

Am I missing something?

Thanks in advance.

@radeva
Copy link
Contributor

radeva commented Aug 18, 2017

Hi @gpfiel ,

You can see in the demo's package.json that it uses the plugin implementation from the src folder which requires to run npm i and tsc in both the src first. It looks like you missed and the plugin's TypeScript files are not transpiled to javascript. To ease the plugin and demo builds we have created some scripts to do this so you need just to follow these steps:

  • open Terminal / Command Promt and navigate to nativescript-facebook folder
  • run git clean -fdx . This will clean all non-versioned files which were generated from tns run. Or just get a clean copy of the code.
  • go to the demo folder of your choice. For example cd demo
  • run npm run build.plugin - this will install plugin dependencies and transpile the TypeScript
  • run tns run ios - this will install demo dependencies, transpile the TypeScript to javascript and run the application.

Let me know if this works for you.

Best regards,
Veselina

@gpfiel
Copy link
Author

gpfiel commented Aug 18, 2017

Hi @radeva,

Sorry I missed some steps. I checked the package.json, I didn't realize it was using the ../src.
But aftter following the steps above I've got a new problem.

** BUILD SUCCEEDED **

Project successfully built.
Installing...
Successfully installed on device with identifier 'D7FF528C-C525-4DB2-8264-1E2BB88D8F3A'.
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.demoangular on device D7FF528C-C525-4DB2-8264-1E2BB88D8F3A.
Executing before-watch hook from /Library/WebServer/Documents/nativescript-facebook/demo-angular/hooks/before-watch/nativescript-dev-typescript.js
Found peer TypeScript 2.3.4
objc[70801]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x111a06cc0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x11181d6f0). One of the two will be used. Which one is undefined.
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
1   0x10171171b NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x101de615e ffi_closure_unix64_inner
3   0x101de6a92 ffi_closure_unix64
4   0x102b0c3c3 -[UIViewController __viewWillAppear:]
5   0x102b45b51 -[UINavigationController _startTransition:fromViewController:toViewController:]
6   0x102b46a03 -[UINavigationController _startDeferredTransitionIfNeeded:]
7   0x102b47b41 -[UINavigationController __viewWillLayoutSubviews]
8   0x102d3960c -[UILayoutContainerView layoutSubviews]
9   0x102a2655b -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
10  0x1086d5904 -[CALayer layoutSublayers]
11  0x1086c9526 CA::Layer::layout_if_needed(CA::Transaction*)
12  0x1086c93a0 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13  0x108658e92 CA::Context::commit_transaction(CA::Transaction*)
14  0x108685130 CA::Transaction::commit()
15  0x108685b37 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
16  0x10579d717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
17  0x10579d687 __CFRunLoopDoObservers
18  0x105782038 CFRunLoopRunSpecific
19  0x10295d08f -[UIApplication _run]
20  0x102963134 UIApplicationMain
21  0x101de68ed ffi_call_unix64
22  0x120d73b10
file:///app/tns_modules/@angular/compiler/./bundles/compiler.umd.js:15019:24: JS ERROR Error: Unexpected value 'NativeScriptFacebookModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
Aug 18 10:16:25 gpfiel com.apple.CoreSimulator.SimDevice.D7FF528C-C525-4DB2-8264-1E2BB88D8F3A.launchd_sim[69783] (UIKitApplication:org.nativescript.demoangular[0xcf32][69805][70801]): Service exited due to Segmentation fault: 11
10:16:25 - Compilation complete. Watching for file changes.

Any idea about this one?
The application crashes after it is started.
Thanks for you help :)

Regards,
Gabriel Fiel.

@radeva
Copy link
Contributor

radeva commented Aug 18, 2017

Hi @gpfiel,

I tried the angular demo on my side with iPhone 7 Simulator and it works as expected. Could you give some more info like:

  • CLI version (run tns --version)
  • are you trying to run on Simulator or Device and on what operating system
  • do you have any global installation of angular related packages

You can also try to clean you platforms folder (run rm -rf platformsif you're on MAC) and run tns run ios once again.

If the problem persists, I'll ask you to send us a zip with all the files so we can check it on our side.

Best regards,
Veselina

@gpfiel
Copy link
Author

gpfiel commented Aug 18, 2017

Hi @radeva,

I am trying run it on an Iphone SE (Simulator on Macbook), IOS 10.3, TNS version 3.1.3. My mac os is Sierra.

  • demo-angular (package) the app start but it crashes with error:
    JS ERROR Error: Unexpected value 'NativeScriptFacebookModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
  • demo (package) the app is running and connect to facebook to get the information but in the console I get this problem. But it is working anyway
    -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

The important to me is to make it work on demo-angular because my application is angular.

Regards,
Gabriel Fiel.

@radeva
Copy link
Contributor

radeva commented Aug 18, 2017

Hi @gpfiel,

Could you try to reset Simulator Content and Settings and try to run the demos again? To do so go to Simulator -> Reset Content and Settings. Here is more discussion on that topic.

Best regards,
Veselina

@gpfiel
Copy link
Author

gpfiel commented Aug 18, 2017

Hi @radeva,

I reseted it but I didn't get any changes. Same problem.

Regards,
Gabriel Fiel.

@radeva
Copy link
Contributor

radeva commented Aug 18, 2017

Hi @gpfiel .

To fix the angular demo issue, could you make sure you do not use npm link to link the plugin in demo-angular? To remove any module linking you can do the following:

  • go to src folder and run npm unlink
  • go to demo-angular and run npm unlink nativescript-facebook
  • again in demo-angular run rm -rf node_modules and npm i

This should fix the issue in demo-angular.

Could you try to do the same in demo and tell if the issue there still appears? I'm still not able to reproduce it.

Best regards,
Veselina

@gpfiel
Copy link
Author

gpfiel commented Aug 21, 2017

Hi @radeva,

I was following the steps above but I've got an extra error. Also I did clone the plugin again to ensure it was clean.

Project successfully built.
Installing...
Successfully installed on device with identifier 'E51162E1-5753-4001-B904-2B88B9080607'.
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.demoangular on device E51162E1-5753-4001-B904-2B88B9080607.
Executing before-watch hook from /Library/WebServer/Documents/nativescript-facebook/demo-angular/hooks/before-watch/nativescript-dev-typescript.js
Found peer TypeScript 2.3.4
objc[1905]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x11ae4bcc0) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x11ac626f0). One of the two will be used. Which one is undefined.

2 import * as Facebook from "nativescript-facebook";
                            ~~~~~~~~~~~~~~~~~~~~~~~

app/app.component.ts(2,27): error TS2307: Cannot find module 'nativescript-facebook'.



7 import { NativeScriptFacebookModule } from "nativescript-facebook/angular";
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/app.module.ts(7,44): error TS2307: Cannot find module 'nativescript-facebook/angular'.



2 import * as Facebook from "nativescript-facebook";
                            ~~~~~~~~~~~~~~~~~~~~~~~

app/pages/home/home.component.ts(2,27): error TS2307: Cannot find module 'nativescript-facebook'.



6 import { NativeScriptFacebookModule } from "nativescript-facebook/angular";
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/pages/home/home.module.ts(6,44): error TS2307: Cannot find module 'nativescript-facebook/angular'.



2 import * as Facebook from "nativescript-facebook";
                            ~~~~~~~~~~~~~~~~~~~~~~~

app/pages/login/login.component.ts(2,27): error TS2307: Cannot find module 'nativescript-facebook'.



6 import { NativeScriptFacebookModule } from "nativescript-facebook/angular";
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

app/pages/login/login.module.ts(6,44): error TS2307: Cannot find module 'nativescript-facebook/angular'.


11:09:11 - Compilation complete. Watching for file changes.



Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
Falling back to loading access token from NSUserDefaults because of simulator bug
Falling back to storing access token in NSUserDefaults because of simulator bug
1   0x10ab5e71b NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
2   0x10b23315e ffi_closure_unix64_inner
3   0x10b233a92 ffi_closure_unix64
4   0x10c3bc3c3 -[UIViewController __viewWillAppear:]
5   0x10c3f5b51 -[UINavigationController _startTransition:fromViewController:toViewController:]
6   0x10c3f6a03 -[UINavigationController _startDeferredTransitionIfNeeded:]
7   0x10c3f7b41 -[UINavigationController __viewWillLayoutSubviews]
8   0x10c5e960c -[UILayoutContainerView layoutSubviews]
9   0x10c2d655b -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
10  0x111bae904 -[CALayer layoutSublayers]
11  0x111ba2526 CA::Layer::layout_if_needed(CA::Transaction*)
12  0x111ba23a0 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
13  0x111b31e92 CA::Context::commit_transaction(CA::Transaction*)
14  0x111b5e130 CA::Transaction::commit()
15  0x111b5eb37 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
16  0x10ed3f717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
17  0x10ed3f687 __CFRunLoopDoObservers
18  0x10ed24038 CFRunLoopRunSpecific
19  0x10c20d08f -[UIApplication _run]
20  0x10c213134 UIApplicationMain
21  0x10b2338ed ffi_call_unix64
22  0x12a175b10
file:///app/tns_modules/@angular/compiler/./bundles/compiler.umd.js:15019:24: JS ERROR Error: Unexpected value 'NativeScriptFacebookModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
Aug 21 11:09:13 gpfiel com.apple.CoreSimulator.SimDevice.E51162E1-5753-4001-B904-2B88B9080607.launchd_sim[98244] (UIKitApplication:org.nativescript.demoangular[0xbb60][98266][1905]): Service exited due to Segmentation fault: 11

Regards,
Gabriel Fiel.

@radeva
Copy link
Contributor

radeva commented Aug 21, 2017

Hi @gpfiel,

Have you run npm run build.plugin from the demoor demo-angular folder? Take a look at my first answer above.

Best regards,
Veselina

@gpfiel
Copy link
Author

gpfiel commented Aug 21, 2017

Hi @radeva,

Yes, I did it. The demo folder is working fine.
My issue is demo-angular.

If possible could we have a call on skype? So I can show whats is happening there.

Skype: gpfiel

Regards,
Gabriel Fiel

@radeva
Copy link
Contributor

radeva commented Aug 21, 2017

Hi @gpfiel,

Let's have a chat in the NativeScript Community Slack. I sent you an invitation.

In the meantime you can try to

  • go to demo-angular
  • rm -rf node_modules
  • rm -rf platforms
  • npm i
  • tns run ios

Best regards,
Veselina

@radeva
Copy link
Contributor

radeva commented Aug 22, 2017

SOLVED: JS ERROR Error: Unexpected value 'NativeScriptFacebookModule' imported by the module 'AppModule'. Please add a @NgModule annotation. error can be fixed by installing the nativescript-facebook plugin from npm and not from the srcfolder.

@dtopuzov
Copy link

dtopuzov commented Aug 23, 2017

@gpfiel @radeva
Can you please test with nativescript@next, yesterday we pushed a fix that should resolve this issue.

@zbranzov
Copy link
Contributor

zbranzov commented Aug 23, 2017

I'm closing this issue as the above fix solves it. It was caused by the npm 5 symlinks. More info can be found in fix description. If you want to install the version of nativescript containing the fix use "npm i nativescript@next -g" or wait for the official release.
@gpfiel

@ghost ghost removed the in progress label Aug 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants