Skip to content
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

pub get change Lockfile(pubspec.lock) when PUB_HOSTED_URL changed #2226

Open
shifujun opened this issue Oct 15, 2019 · 4 comments
Open

pub get change Lockfile(pubspec.lock) when PUB_HOSTED_URL changed #2226

shifujun opened this issue Oct 15, 2019 · 4 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@shifujun
Copy link

Environment

  • pub version or flutter pub version:
    Pub 2.4.1
  • OS version:
    Mac OS X 10.14.6
  • Are you using the Chinese community mirror or a corporate firewall?
    Yes.

Problem

  1. set PUB_HOSTED_URL=https://pub.flutter-io.cn
  2. Init a dart project.
  3. run pub get, generate a pubspec.lock file.
  4. unset PUB_HOSTED_URL with unset PUB_HOSTED_URL
  5. rerun pub get, then pubspec.lock file changed.

image

Not only the url changed, but also the version upgrade.

Expected behavior

  • Download the dependence from url and version recorded in pubspec.lock.

OR

  • Exit with error said PUB_HOSTED_URL not same with pubspec.lock used.

Actual behavior

pub get run success and changed pubspec.lock, which was not the behavior like the doc said. The doc said pub get use pubspec.lock, and there are pub upgrade and pub downgrade change pubspec.lock.

@bennya8
Copy link

bennya8 commented Mar 14, 2020

the same issue, have to unset PUB_HOSTED_URL var using default repo to solve the problem.. -_-

@sigurdm sigurdm added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 17, 2020
@wangpan2011
Copy link

wangpan2011 commented May 29, 2020

I think it has nothing to do with pub hosted server.
Came across the same issue when I use a new flutter sdk version and an empty local pub cache.
Downgrade flutter sdk to the version when the lock file was generated solve this problem.

@yujiuqie
Copy link

If you set flutter export path (path_to_flutter) both in ~/.zshrc and ~/.bash_profile,make sure you have added blew codes in both files, or only keep ~/.bash_profile configuration.

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/path_to_flutter/flutter/bin:$PATH

@sinkcup
Copy link

sinkcup commented Aug 30, 2023

HACK:

if [ "$PUB_HOSTED_URL" ]; then sed -i "s|https://pub.dev|$PUB_HOSTED_URL|g" pubspec.lock; fi
flutter pub get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants