Error on line 1, column 1 of pubspec.lock: Unexpected character
3,779
Solution 1
The file pubspec.lock is a generated file, so you can delete it and then regenerate it.
Delete pubspec.lock.
Run the following command:
flutter pub get
or
flutter pub upgrade
Notes on pub upgrade (you could probably skip the delete step).
Solution 2
Delete the file at flutter/packages/flutter_tools/pubspec.lock then try flutter pub upgrade again.
You may have interrupted the upgrade process before it finished hence the file became invalid.
Solution 3
I took the same error, but this error was coming from my main folder. in this path "C:\Users"yourusername"\AppData\Local\Pub\Cache\global_packages\devtools" I deleted the file and I started app. file has been by itself created and problem solved.
Author by
hassan
Updated on December 22, 2022Comments
-
hassan over 1 year
I tried to run
flutter pub get
and I got this error:Error on line 1, column 1 of pubspec.lock: Unexpected character ╷ 1 │ │ ^ ╵ pub upgrade failed (65; ╵)