NativeScript / NativeScript/nativescript-cli

References of removed dependencies are not deleted from Podfile

Open
#5,153 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug os: ios
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.2.0
  • Cross-platform modules: 6.2.0
  • Android Runtime: 6.2.0
  • iOS Runtime:
  • Plugin(s):

Describe the bug
When a dependency is uninstalled, its reference is not deleted from Podfile in platforms and that leads to the error when trying to run the application on device.

To Reproduce

  1. tns create myApp --js
  2. tns prepare ios
  3. npm i tns-core-modules@6.1.0
  4. tns prepare ios
  5. You will see the following log in the output:
[!] CocoaPods could not find compatible versions for pod "MaterialComponents/Tabs":
  In snapshot (Podfile.lock):
    MaterialComponents/Tabs (= 92.4.0, ~> 92.3)

  In Podfile:
    MaterialComponents/Tabs (~> 84.4)

    MaterialComponents/Tabs (~> 92.3)

None of your spec sources contain a spec satisfying the dependencies: `MaterialComponents/Tabs (~> 92.3), MaterialComponents/Tabs (~> 84.4), MaterialComponents/Tabs (= 92.4.0, ~> 92.3)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

[!] There are duplicate dependencies on `MaterialComponents/Tabs` in `Podfile`:

- MaterialComponents/Tabs (~> 92.3)
- MaterialComponents/Tabs (~> 84.4)

and the content of Podfile is the following:

use_frameworks!

target "newPodfileIssue" do
# NativeScriptPlatformSection /Users/myuser/Work/nativescript-cli/scratch/newPodfileIssue/node_modules/@nativescript/core/platforms/ios/Podfile with 9.0
platform :ios, '9.0'
# End NativeScriptPlatformSection


# Begin Podfile - /Users/myuser/Work/nativescript-cli/scratch/newPodfileIssue/node_modules/@nativescript/core/platforms/ios/Podfile
# platform :ios, '9.0'
use_frameworks!

pod 'MaterialComponents/Tabs', '~> 92.3'
# End Podfile

# Begin Podfile - /Users/myuser/Work/nativescript-cli/scratch/newPodfileIssue/node_modules/tns-core-modules/platforms/ios/Podfile
# platform :ios, '9.0'
use_frameworks!

pod 'MaterialComponents/Tabs', '~> 84.4'
# End Podfile

Expected behavior

It should work and the reference to /Users/myuser/Work/nativescript-cli/scratch/newPodfileIssue/node_modules/@nativescript/core/platforms/ios/Podfile should be deleted from Podfile.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Podfile generation and cleanup flow used by tns prepare ios, focusing on the generated Podfile under platforms. Reproduce the uninstall and version-change steps from the issue, then verify that references from removed node_modules dependencies are absent and that preparation no longer reports duplicate or incompatible pods.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
cli, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.