Flutter project showing me a warning 'Packages get' has not been run with suggested solutions,
Get Dependencies
Upgrade Dependencies
Ignore
As suggested by Darky, in this answer to go ahead with 'Get Dependencies'
I tried it but it shows me an error:
pub get failed
/SoftSources/Flutter/flutter/bin/flutter --no-color packages get
Running "flutter packages get" in catalog...
Incompatible version constraints on test:
- flutter_test 0.0.0 depends on version 0.12.30+3
- sample_catalog depends on version 0.12.30+4
pub get failed (1)
Process finished with exit code 1
An error indicates an issue with the version of the project (or something else), where should change it in my flutter project?
Edit: pubspec.yaml
name: sample_catalog
description: A collection of Flutter sample apps
dependencies:
flutter:
sdk: flutter
path: 1.5.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
args: 1.3.0 # TRANSITIVE DEPENDENCY
async: 2.0.4 # TRANSITIVE DEPENDENCY
barback: 0.15.2+14 # TRANSITIVE DEPENDENCY
boolean_selector: 1.0.2 # TRANSITIVE DEPENDENCY
charcode: 1.1.1 # TRANSITIVE DEPENDENCY
cli_util: 0.1.2+1 # TRANSITIVE DEPENDENCY
collection: 1.14.5 # TRANSITIVE DEPENDENCY
convert: 2.0.1 # TRANSITIVE DEPENDENCY
crypto: 2.0.2+1 # TRANSITIVE DEPENDENCY
csslib: 0.14.1 # TRANSITIVE DEPENDENCY
file: 2.3.6 # TRANSITIVE DEPENDENCY
glob: 1.1.5 # TRANSITIVE DEPENDENCY
html: 0.13.2+2 # TRANSITIVE DEPENDENCY
http: 0.11.3+16 # TRANSITIVE DEPENDENCY
http_multi_server: 2.0.4 # TRANSITIVE DEPENDENCY
http_parser: 3.1.1 # TRANSITIVE DEPENDENCY
intl: 0.15.2 # TRANSITIVE DEPENDENCY
io: 0.3.2+1 # TRANSITIVE DEPENDENCY
isolate: 1.1.0 # TRANSITIVE DEPENDENCY
js: 0.6.1 # TRANSITIVE DEPENDENCY
json_rpc_2: 2.0.7 # TRANSITIVE DEPENDENCY
logging: 0.11.3+1 # TRANSITIVE DEPENDENCY
matcher: 0.12.1+4 # TRANSITIVE DEPENDENCY
meta: 1.1.2 # TRANSITIVE DEPENDENCY
mime: 0.9.6 # TRANSITIVE DEPENDENCY
mockito: 2.2.3 # TRANSITIVE DEPENDENCY
multi_server_socket: 1.0.1 # TRANSITIVE DEPENDENCY
node_preamble: 1.4.0 # TRANSITIVE DEPENDENCY
package_config: 1.0.3 # TRANSITIVE DEPENDENCY
package_resolver: 1.0.2 # TRANSITIVE DEPENDENCY
plugin: 0.2.0+2 # TRANSITIVE DEPENDENCY
pool: 1.3.4 # TRANSITIVE DEPENDENCY
pub_semver: 1.3.2 # TRANSITIVE DEPENDENCY
quiver: 0.28.0 # TRANSITIVE DEPENDENCY
shelf: 0.7.2 # TRANSITIVE DEPENDENCY
shelf_packages_handler: 1.0.3 # TRANSITIVE DEPENDENCY
shelf_static: 0.2.7 # TRANSITIVE DEPENDENCY
shelf_web_socket: 0.2.2 # TRANSITIVE DEPENDENCY
source_map_stack_trace: 1.1.4 # TRANSITIVE DEPENDENCY
source_maps: 0.10.4 # TRANSITIVE DEPENDENCY
source_span: 1.4.0 # TRANSITIVE DEPENDENCY
stack_trace: 1.9.1 # TRANSITIVE DEPENDENCY
stream_channel: 1.6.3 # TRANSITIVE DEPENDENCY
string_scanner: 1.0.2 # TRANSITIVE DEPENDENCY
term_glyph: 1.0.0 # TRANSITIVE DEPENDENCY
test: 0.12.30+4 # TRANSITIVE DEPENDENCY
typed_data: 1.1.5 # TRANSITIVE DEPENDENCY
utf: 0.9.0+4 # TRANSITIVE DEPENDENCY
vector_math: 2.0.5 # TRANSITIVE DEPENDENCY
vm_service_client: 0.2.4+1 # TRANSITIVE DEPENDENCY
watcher: 0.9.7+7 # TRANSITIVE DEPENDENCY
web_socket_channel: 1.0.7 # TRANSITIVE DEPENDENCY
yaml: 2.1.13 # TRANSITIVE DEPENDENCY
flutter:
uses-material-design: true
For Flutter projects run
flutter packages get
Instead of
pub get packages
Replace inside your devDependencies
test: 0.12.30+4 # TRANSITIVE DEPENDENCY
with
test: 0.12.30+3
Or you can potentially switch to master branch on flutter. Because you most likely clone an example of a project based on flutter's master
People who you are from Windows OS and still cannot solve pub get failed (1; no message) exit code 1 problem, you can try the below steps:
Open Start -> Run -> regedit
Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun (If it doesn't exist, create a String value)
Change the value to #chcp 65001>nul
Run flutter upgrade --force
Run flutter pub get in your flutter project folder
If it's not showing pub get failed anymore, then you can run your app in your app emulator or physical device.
Note: This may take some time to run your app.
Last but not least, pub get failed was a horrible error for me!
Solution collected from here
Click on the Link get packages in the given environment like VS code
or
save your code while pubspec.yaml file is opened will get flutter packages for you automatically.
Check syntax in pubspec.yaml, it should look like this
dependencies:
flutter:
sdk: flutter
provider: ^6.0.0
cupertino_icons: ^1.0.2
What I had was like this which was incorrect.
dependencies:
flutter:
sdk: flutter
provider: ^6.0.0
cupertino_icons: ^1.0.2
The other thing is check for syntax errors in other files such as missing ] or ). I had both the issues, once that were fixed, the error went away.
In my case with a similar error, I specified intl: 0.18.0 in the dependencies. After removing it, everything worked fine.
Related
When I add the egui dependency and try to build the project it cannot resolve the dependency due to the following error:
➜ langcard git:(master) ✗ cargo build
Updating crates.io index
error: failed to select a version for the requirement `egui = "^0.19.0"`
candidate versions found which didn't match: 0.17.0, 0.16.1, 0.16.0, ...
location searched: crates.io index
required by package `langcard v0.1.0 (/Users/admin/Code/rust/langcard)`
Here's the package I am trying to build with:
https://crates.io/crates/egui
Any ideas?
I'm needing some help locking versions of node module transitive dependencies (dependencies of dependencies).
My company uses a mirror of npmjs.com registry. In light of recent malicious npm packages this mirror has enabled a feature to "quarantine" newly published packages for n-number of days until they have been deemed safe to use. When a newly published package is quarantined in our mirror it is not available for use and will 403 when trying to install.
We've since started to use strong versions of our packages in our package.json file - no range qualifiers are found in our package.json - no *'s - no ~'s - no ^'s.
We use yarn as our package manager. We commit our yarn.lock files to git. Upon looking more closely at our yarn.lock file, we obviously see transitive dependencies using range qualifiers. Transitive dependencies using range qualifiers in combination with our npm mirror's quarantine rules for newly published packages is causing a new yarn install error almost daily.
We're looking for a way to lock down specific versions of our transitive dependencies.
Do we manually update our yarn.lock file removing all range qualifiers? Do we switch to a different package manager? npm? pnpm?
Thoughts?
Hey in yarn you can specify in the package.json resolutions
"resolutions": {
"d2/left-pad": "1.1.1",
"c/**/left-pad": "^1.1.2"
}
You can read more here
This is the scenario:
I have a package, say package-a that depends on package-b. I have version 2.0.0 of package-a depends on version 1.1.0 of package-b. I specified this dependency using the notation: ^1.1.0. I generated the lock file and then the shrinkwrap. I then publish package-a to the repository.
My understanding is that the above ensures that whenever version 2.0.0 of package-a is installed it will always use version 1.1.0 of package-b even if there are newer version of package-b.
This does not seem to be the case, because when I bumb package-b to 1.2.0, then I deleted package-a and re-installed it, when I check its node_module, I see it installs version 1.2.0 of package-b with it (instead of 1.1.0 that is specified in the shrinkwrap file)
How to I fix this? How do I ensure that my package will always install what is found in the shrinkwrap file?
Or maybe I understand how the nom shrinkwrap file should work? If so an explanation of why what I did, did not work. I would appreciate pointers on how to also make it work as I want
I want to install latest Flutter packages in my android studio project.
In npm, npm install <package name> installs latest packages automatically and npm update updates all packages automatically.
Is there any way to do this in Flutter?
Yes it is possible to update existing packages. Use the flutter command below:
flutter pub outdated
This was introduced in Dart 2.8:
As of Dart 2.8, you can use pub outdated, a new tool for automatically determining which of your dependencies need to be updated to the latest and greatest versions.
With a release of Flutter 2.0 you can now upgrade flutter dependency packages automatically using these below command lines:
flutter pub outdated
flutter pub upgrade --major-versions
Let's say you have these packages in your pubspec.yaml file
dependencies:
foo: ^1.0.0
bar: ^5.0.0
And at some point in future there is an update available for both of them, and you decide to run
flutter pub outdated
It would now list something like:
Dependencies Current Upgradable Resolvable Latest
foo 1.0.0 1.2.0 1.2.0 1.2.0
bar 5.0.0 5.3.0 6.0.0 6.0.0
You see there is no breaking change for foo, since it is still on 1.x.x, however, bar has got a breaking change, it has been updated from 5.x.x to 6.x.x. So what should you do now?
If you safely want to update the packages without breaking your code, run
flutter pub upgrade
This would now create pubspec.lock file with
packages:
foo:
version: "1.2.0"
bar:
version: "5.3.0"
If you want to update both of them to the latest version, you'll have to manually do it in pubspec.yaml file by specifying (foo won't need manual version):
dependencies:
bar: ^6.0.0
This would create pubspec.lock file with
packages:
foo:
version: "1.2.0"
bar:
version: "6.0.0"
You can check version is out dated or not using flutter pub outdated command.
in output you will get all outdated versions.
Output:
Dependencies Current Upgradable Resolvable Latest
carousel_pro *0.0.13 *0.0.13 1.0.0 1.0.0
firebase_auth *0.15.4 *0.15.5+3 0.16.0 0.16.0
Here, current version show, which you are using and latest show which package version is available.
Note: You have to specify latest version in pubspec.yaml file and then you have to run.
flutter pub get
One of our apps (my-app) dependencies is an npm lib we publish to npm (my-lib).
name: my-app;
version: <my-app-version>
dependencies: {
my-lib: <my-lib-version>
}
As a company we are committed to support the current version and 1 older version.
my-app 1.0.0 depends on my-lib 1.0.0
name: my-app;
version: 1.0.0
dependencies: {
my-lib: 1.0.0
}
my-app 2.0.0 depends on latest my-lib which is 3.1.0
name: my-app;
version: 2.0.0
dependencies: {
my-lib: 3.1.0
}
We have a bug in my-lib which we must fix for both.
The easy thing to do would be fixing in 3.1.0,
but my-app 1.0.0 can't adopt 3.1.0 as it introduces breaking changes, and must stay in version 1.X.X.
What's the standard way to fix my-lib in both?
If you decide to update both 1.x.x and 3.x.x versions, you might keep working on 2 separated GIT branches and publish 2 separate patch releases on NPM.