Issue running new projects if an older environment (pre null safety) exists
I have an app that still uses Flutter 3.7.12 so I have that as an "old" environment. I also have the latest as "stable". At some point not that long ago I can no longer run newer (stable) projects. I see this output:
Resolving dependencies...
The current Dart SDK version is 2.19.6.
Because volleyball_hub requires SDK version >=3.3.4 <4.0.0, version solving failed.
pub get failed
The only way to resolve it is to delete the "old" environment.
A little more detail is given when I run from terminal:
pub get failed
command: "/Users/johnwiese/.puro/envs/old/flutter/bin/cache/dart-sdk/bin/dart __deprecated_pub --color
--directory . get --example"
pub env: {
"FLUTTER_ROOT": "/Users/johnwiese/.puro/envs/old/flutter",
"PUB_ENVIRONMENT": "flutter_cli:get",
"PUB_CACHE": "/Users/johnwiese/.puro/shared/pub_cache",
}
exit code: 1
johnwiese@Johns-MacBook-Pro volleyball_hub % puro ls
[i] Environments:
* stable (stable / 3.22.3 / b0850beeb2)
beta (not installed)
master (not installed)
old (stable / 3.7.12 / 4d9e56e694)
Notice though that the output says FLUTTER_ROOT is set to "old" and not "stable", which is why I assume I am getting the error??
If I run puro version I get this output:
johnwiese@Johns-MacBook-Pro volleyball_hub % puro version
[!] Other Flutter or Dart installations detected
Puro recommends removing the following from your PATH:
* /Users/johnwiese/.puro/envs/old/flutter/bin//dart
* /Users/johnwiese/.puro/envs/old/flutter/bin//flutter
[i] Puro 1.4.6 (distribution/darwin-x64)
Dart 3.3.3 (stable) (Tue Mar 26 14:21:33 2024 +0000) on "macos_x64"
The problem is the only path setting I can find is in my .zshrc and doesn't have any of those entries:
export PATH="$PATH:$HOME/.puro/bin" # Added by Puro
export PATH="$PATH:$HOME/.puro/shared/pub_cache/bin" # Added by Puro
export PATH="$PATH:$HOME/.puro/envs/default/flutter/bin" # Added by Puro
export PURO_ROOT="/Users/johnwiese/.puro" # Added by Puro
export PUB_CACHE="/Users/johnwiese/.puro/shared/pub_cache" # Added by Puro
PATH=$PATH:/users/johnwiese/Library/Android/sdk
This is likely the IDE adding the old one to the PATH, try running puro use stable in the root of your project.