With a standard package.json using more than 2 individual ui-* package as follows:

Will cause UICore.framework to be added multiple times to project for each ui-* package:



Causing these problems:



This is critical.
@bugventure @vchimev ^
Thanks @NathanWalker for reporting this. Could you specify which version of npm are you using?
I tried with npm 5.6.0 to reproduce this but without any luck. Here are the steps I tried:
Could you these steps on your side and get back with the result?
In the meantime for the application where you experience this issue, could you remove node_modules, package-lock.json and try to install the dependencies again.
@radeva I'm using node 9.4.0 and 5.6.0. When I generate a new simple project with your steps, it's okay. However on my larger project, same problem occurs after a full clean and reinstall, I have to manually open XCode project and remove the extra TNSCore everytime.
This is the full dependency list:
"nativescript-angular": "^5.2.0",
"nativescript-background-http": "^3.1.0",
"nativescript-coachmarks": "~2.0.3",
"nativescript-fancyalert": "^1.1.2",
"nativescript-image-zoom": "^1.1.1",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-ngx-fonticon": "^4.0.0",
"nativescript-payments": "0.0.10",
"nativescript-plugin-firebase": "~5.1.8",
"nativescript-social-share": "^1.5.0",
"nativescript-theme-core": "^1.0.4",
"nativescript-ui-listview": "^3.5.1",
"nativescript-ui-sidedrawer": "^3.5.1",
@NathanWalker The thing is that this is not expected behaviour and we would like to know what's causing it in order to decide what's the proper way to fix it. I'll check with these dependencies and the same version of node (have in mind 9.X is not LTS so it might be causing issues as well) and get back to you.
Could you send me the whole package.json? And also let me know the NativeScript version you're using?
@NathanWalker do you have this output during a build:
2018-03-20 17:08:30.817 xcodebuild[13590:373842] [MT] IDEDistribution: Step failed: <IDEDistributionPackagingStep: 0x7faef788d720>: Error Domain=IDEFoundationErrorDomain Code=1 "Failed to verify bitcode in TNSCore.framework/TNSCore:
error: Cannot extract bundle from /var/folders/qn/rgqwl65s4xzcvkm3_zfc31c80000gn/T/XcodeDistPipeline.bH9/Root/Payload/evalmobile.app/app/tns_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/TNSCore (i386)
" UserInfo={NSLocalizedDescription=Failed to verify bitcode in TNSCore.framework/TNSCore:
error: Cannot extract bundle from /var/folders/qn/rgqwl65s4xzcvkm3_zfc31c80000gn/T/XcodeDistPipeline.bH9/Root/Payload/evalmobile.app/app/tns_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/TNSCore (i386)
}
error: exportArchive: Failed to verify bitcode in TNSCore.framework/TNSCore:
error: Cannot extract bundle from /var/folders/qn/rgqwl65s4xzcvkm3_zfc31c80000gn/T/XcodeDistPipeline.bH9/Root/Payload/evalmobile.app/app/tns_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/TNSCore (i386)
Error Domain=IDEFoundationErrorDomain Code=1 "Failed to verify bitcode in TNSCore.framework/TNSCore:
error: Cannot extract bundle from /var/folders/qn/rgqwl65s4xzcvkm3_zfc31c80000gn/T/XcodeDistPipeline.bH9/Root/Payload/evalmobile.app/app/tns_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/TNSCore (i386)
" UserInfo={NSLocalizedDescription=Failed to verify bitcode in TNSCore.framework/TNSCore:
error: Cannot extract bundle from /var/folders/qn/rgqwl65s4xzcvkm3_zfc31c80000gn/T/XcodeDistPipeline.bH9/Root/Payload/evalmobile.app/app/tns_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework/TNSCore (i386)
}
** EXPORT FAILED **
Unable to apply changes on device: cc570d6ef97bc2ced760463db5bea4cf759801ae. Error is: Command xcodebuild failed with exit code 70.
I'm looking into the rest of the logs currently during an xcode build to see if the ui package is prepped twice.
Here are my deps:
"dependencies": {
"@angular/animations": "5.2.6",
"@angular/cdk": "^5.2.1",
"@angular/common": "5.2.6",
"@angular/compiler": "5.2.6",
"@angular/core": "5.2.6",
"@angular/forms": "5.2.6",
"@angular/http": "^5.2.7",
"@angular/material": "^5.2.1",
"@angular/platform-browser": "5.2.6",
"@angular/platform-browser-dynamic": "5.2.6",
"@angular/router": "5.2.6",
"core-js": "^2.4.1",
"rxjs": "^5.5.6",
"@nrwl/nx": "0.8.0",
"@ngx-translate/core": "~9.0.2",
"@ngrx/effects": "5.1.0",
"@ngrx/router-store": "5.0.1",
"@ngrx/store": "5.1.0",
"@ngrx/store-devtools": "5.1.0",
"email-validator": "^1.1.1",
"kinvey-nativescript-sdk": "~3.10.0",
"nativescript-angular": "~5.2.0",
"nativescript-barcodescanner": "~2.7.5",
"nativescript-carousel": "~3.1.1",
"nativescript-drop-down": "~3.2.3",
"nativescript-exoplayer": "~3.4.1",
"nativescript-fresco": "~3.0.6",
"nativescript-snackbar": "~2.0.1",
"nativescript-loading-indicator": "~2.4.0",
"nativescript-localstorage": "~1.1.5",
"nativescript-ngx-fonticon": "~4.0.0",
"nativescript-permissions": "~1.2.3",
"nativescript-social-share": "~1.5.0",
"nativescript-theme-core": "~1.0.4",
"nativescript-ui-listview": "~3.5.1",
"nativescript-ui-sidedrawer": "~3.5.1",
"ngx-progressbar": "^2.1.1",
"primeng": "^5.2.0",
"reflect-metadata": "^0.1.12",
"tns-core-modules": "^3.4.1",
"ts-md5": "^1.2.4",
"zone.js": "^0.8.19"
},
The two ui packages being listview and sidedrawer.
I have not done a release build. I have had someone ping me privately saying they cannot run the application as the xcode build errors out with the above exception. However, when I ran it, it failed but then immediately built again and installed and the app runs fine.
After looking at the logs from tns run ios --syncAllFiles
it does prep the ui package twice.
Executing before-prepareJSApp hook from /Users/bradmartin/Desktop/EvalApp/maxmobility/apps/eval-mobile/hooks/before-prepareJSApp/nativescript-dev-webpack.js
Successfully prepared plugin kinvey-nativescript-sdk for ios.
Successfully prepared plugin nativescript-angular for ios.
Successfully prepared plugin nativescript-barcodescanner for ios.
Successfully prepared plugin nativescript-carousel for ios.
Successfully prepared plugin nativescript-drop-down for ios.
Successfully prepared plugin nativescript-exoplayer for ios.
Successfully prepared plugin nativescript-fresco for ios.
Successfully prepared plugin nativescript-loading-indicator for ios.
Successfully prepared plugin nativescript-localstorage for ios.
Successfully prepared plugin nativescript-ngx-fonticon for ios.
Successfully prepared plugin nativescript-snackbar for ios.
Successfully prepared plugin nativescript-theme-core for ios.
Successfully prepared plugin nativescript-ui-listview for ios.
Successfully prepared plugin nativescript-ui-sidedrawer for ios.
Successfully prepared plugin tns-core-modules for ios.
Successfully prepared plugin nativescript-sqlite for ios.
Successfully prepared plugin nativescript-intl for ios.
Successfully prepared plugin nativescript-ui-core for ios.
Successfully prepared plugin nativescript-ui-core for ios.
Successfully prepared plugin tns-core-modules-widgets for ios.
Installing pods...
Analyzing dependencies
My versions:
Brads-MBP:maxmobility bradmartin$ npm -v
5.5.1
Brads-MBP:maxmobility bradmartin$ node -v
v8.9.1
nativescript : 3.4.0
Going to try updating the cli and see if it continues as well.
@bradmartin From the log above I can see that there is a node_modules folder in the installed listview package. This is the reason for having issues with multiple core modules in ios. This is not expected and what I'm trying to understand what is causing it - is it some combination of versions or the package-lock.json or anything else. Could you send us some project where this is reproducible (you can use slack or mail)?
@NathanWalker @bradmartin Could you try the following:
npm iCheck if there is node_modules folder in nativescript-ui-listview and nativescript-ui-sidedrawer.
@bradmartin There are a lot of fixes in 5.6.0 so I would recommend to upgrade to 5.6.0 or later: https://github.com/npm/npm/releases/tag/v5.6.0 .
@radeva I'm hoping to have a repo together for you to see this week 馃憤 thanks for the attention.
Ok @radeva here is a project you can use to repro this issue:
https://github.com/NathanWalker/ui-core-issue
See README
Hi @NathanWalker,
When calling npm run clean this cleans node_modules, hooks, etc.. from the root and installs the dependencies from the package.json on the root level. This installs nativescript-ui-listview and nativescript-ui-sidedrawer. You can see at this stage that there is no node_modules folder in nativescript-ui-sidedrawer and nativescript-ui-listview.
When calling npm run clean.mobile you install the dependencies defined in apps/nativescript-app/package.json which refer to the local folder - the node_modules folder on the root level. With npm5 this creates a symlink and installs the dependencies of the of the dependencies. See npm install <folder> in https://docs.npmjs.com/cli/install . That's how the node_modules folder appears in the nativescript-ui-listview and nativescript-ui-sidedrawer installed packages which causes the errors that you experience.
Your suggestion probably will solve the problem in your setup, but for all other developers out there using the plugins it will require the additional step to install the core package explicitly. So, I'm curious to know what's the reason behind referring your dependencies from a local folder and not from npm?
@radeva - I believe the reasoning is the concept behind Nx Workspaces (https://nrwl.io/nx/guide-nx-workspace#create-a-new-nx-workspace). I'll let Nathan confirm that but I think that's why the packages are local and not npm all the time.
@radeva @bradmartin Definitely. I have projects where one single Nx workspace houses multiple NativeScript projects - all of which can and should share the same dependencies - in fact they even share a lot of the same code. Defining them individually for each app package.json is not only inefficient to do a clean and reinstall but also would take up massive amounts of hard drive space to coexist. Sharing the dependencies creates the link and makes doing a clean on any of the NativeScript app targets in the workspace much quicker and efficient, not to mention easier to maintain since all dependencies (web and {N}) can be maintained/managed from the root of workspace.
HI @NathanWalker @bradmartin
Thanks for the clarification. We'll consider this scenario and keep you posted.
@radeva I had to remove solution comment I posted above. Turns out adding ui-core as dep in root does NOT fix it unfortunately. Still trying to find adequate solution/workaround. Only solution at moment would be changing the way the ui-* plugins are published (removing ui-core in deps) - original solution/suggestion above. Lemme know if you have any other thoughts you'd like me to try?
In fact, adding ui-core to root deps adds/prepares it 3 times! :(
@NathanWalker The only solution that comes to my mind is not to use ui plugins as local dependencies but getting them from npm.
In the meantime we had a discussion that your scenario is valid and we need to handle it in the CLI. Ping @rosen-vladimirov for more info
Hey @NathanWalker ,
First of all, please excuse me for the delayed reply.
We've discussed this issue and we have tried some solutions. Basically we do not want to lose the plug-and-play functionality of the plugins, so we prefer keeping the nativescript-ui-core as a direct dependency of the other nativescript-ui-* plugins. However, we consider the issue you've found with a high priority. Also the same case may happen in other situations, without using this project structure - consider the case where different dependencies rely on different version of the same plugin. In this case the iOS Build will fail once again.
So our idea is to implement a mechanism in CLI that checks all dependencies that should be included in the native project. In case there are duplicate dependencies, CLI will do the following:
What do you think about this proposal? Do you think this will resolve the issue you've faced?
@rosen-vladimirov just now seeing this comment. Thank you so much for this consideration and solution! I love your proposed resolution and quite excited about seeing this fix out there, it sounds like a perfect way to handle!
Is there anyway I could collaborate to help bring this fix to reality sooner rather than later?
Just my two cents on this issue:
There really should also be a project level Podfile for iOS like there is a Gradle file for Android.
2 reasons for this:
platform :ios, '8.0' is in some plugins, and causes conflicts if multiple set it, but really this should be set by the project and not by the plugin.nativescript-IQKeyboardManager. Or to manipulate the pod targets such as nativescript-disable-bitcode. Additionally a developer may want to add other post installs to override the version of a plugin used, or the compile version of swift, etc. (In Gradle I use a similar process to override all android.suport versions requested to the the version I actually want to resolve conflicts like this https://github.com/bthurlow/nativescript-imagecropper/blob/master/src/platforms/android/include.gradle , I added it to that plugin, but I also have a similar setup in my own app.gradle ).This problem started for me now.
I use the listview, sidedrawer, dataform and chart.
Listview and chart dependency [email protected] while sidedrawer and dataform has [email protected].
Looking at node_modules, only listview and chart create another node_modules with [email protected].
When I run tns prepare, three nativescript-ui-core are added and I can not compile in xcode.
聽聽聽聽 "nativescript-ui-chart": "^3.7.0",
聽聽聽聽 "nativescript-ui-dataform": "^3.6.3",
聽聽聽聽 "nativescript-ui-listview": "^3.5.11",
聽聽聽聽 "nativescript-ui-sidedrawer": "^4.3.0"
DataForm, and SideDrawer have been updated recently, it is likely that updating ListView and Chart will correct this problem.
@NathanWalker This issue seems to be at least 5-6 months old. How did you go about fixing this issue? I am also facing issue and don't know how to proceed. Its not possible to remove either of the plugins. Can someone suggest on what's way out?
We get by this problem by specifying directly each one in our package, ie:
"nativescript-ui-chart": "^3.9.0",
"nativescript-ui-listview": "^3.7.0",
The unfortunate thing is that we can鈥檛 reference the packages from another root directory like our other dependencies in our xplat/Nx workspace which is the reason I first reported this. It鈥檚 because the ui-core dep is listed as a dep in each ui-suite package which I personally don鈥檛 prefer. I鈥檇 rather install and manage dependencies myself per project as it allows for much more flexibility in how one can deal with dependencies. (As per my suggestion above I鈥檇 prefer just installing ui-core myself rather than each plugin forcing their own on me which is the problem.) So for now out of all dependencies we work with across many projects the ui-* plugins are the only ones we have to specify directly in each package.
This issue was moved to NativeScript/nativescript-cli#4118
Most helpful comment
Hey @NathanWalker ,
First of all, please excuse me for the delayed reply.
We've discussed this issue and we have tried some solutions. Basically we do not want to lose the plug-and-play functionality of the plugins, so we prefer keeping the
nativescript-ui-coreas a direct dependency of the othernativescript-ui-*plugins. However, we consider the issue you've found with a high priority. Also the same case may happen in other situations, without using this project structure - consider the case where different dependencies rely on different version of the same plugin. In this case the iOS Build will fail once again.So our idea is to implement a mechanism in CLI that checks all dependencies that should be included in the native project. In case there are duplicate dependencies, CLI will do the following:
NOTE: The suggested solution will check only the nativescript plugins of the applications, not all dependencies.
What do you think about this proposal? Do you think this will resolve the issue you've faced?