I'm running pub from within the bleeding edge Dart SDK at commit 93c290047778586c73fe93a72f59bcb69f33a6c5. I'm trying to publish pkg/dart_internal, and when I try, I get:
~/dev/dart/sdk/pkg/dart_internal (master) → pub lish
Publishing dart_internal 0.1.9 to https://pub.dartlang.org:
|-- LICENSE
|-- README.md
|-- analysis_options.yaml
|-- lib
| '-- extract_type_arguments.dart
'-- pubspec.yaml
The getter 'major' was called on null.
Receiver: null
Tried calling: major
dart:core Object.noSuchMethod
package:analyzer/src/dart/ast/ast.dart 2031:34 CompilationUnitImpl.languageVersion
package:pub/src/validator/language_version.dart 58:40 LanguageVersionValidator.validate
package:pub/src/validator.dart 136:64 Validator.runAll.<fn>
dart:async Future.wait
package:pub/src/validator.dart 136:19 Validator.runAll
package:pub/src/command/lish.dart 163:32 LishCommand._validate
package:pub/src/command/lish.dart 143:15 LishCommand.run
package:args/command_runner.dart 197:27 CommandRunner.runCommand
package:pub/src/command_runner.dart 176:39 PubCommandRunner.runCommand.<fn>
dart:async new Future.sync
package:pub/src/utils.dart 113:12 captureErrors.wrappedCallback
dart:async runZoned
package:pub/src/utils.dart 130:5 captureErrors
package:pub/src/command_runner.dart 176:13 PubCommandRunner.runCommand
This is an unexpected error. Please run
pub --trace lish
and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
I don't know if it's related, but yesterday I consistently hit a different NPE running pub publish with a version of pub that's ~1 week old (Pub 2.8.0-dev.16.0.flutter-0296286c03):
...
The method 'toList' was called on null.
Receiver: null
Tried calling: toList()
dart:core Object.noSuchMethod
package:analyzer/src/dart/analysis/file_state.dart 936:51 FileSystemState.getFilesForPath
package:analyzer/src/dart/analysis/file_tracker.dart 232:40 FileTracker.verifyApiSignature.<fn>
package:analyzer/src/dart/analysis/performance_logger.dart 34:15 PerformanceLog.run
package:analyzer/src/dart/analysis/file_tracker.dart 223:20 FileTracker.verifyApiSignature
package:analyzer/src/dart/analysis/driver.dart 924:35 AnalysisDriver.parseFileSync
package:analyzer/src/dart/analysis/session.dart 151:20 AnalysisSessionImpl.getParsedUnit
package:pub/src/dart.dart 124:49 AnalysisContextManager.parse
package:pub/src/validator/language_version.dart 49:39 LanguageVersionValidator.validate
package:pub/src/validator.dart 136:64 Validator.runAll.<fn>
dart:async Future.wait
package:pub/src/validator.dart 136:19 Validator.runAll
package:pub/src/command/lish.dart 163:32 LishCommand._validate
package:pub/src/command/lish.dart 143:15 LishCommand.run
package:args/command_runner.dart 197:27 CommandRunner.runCommand
package:pub/src/command_runner.dart 176:39 PubCommandRunner.runCommand.<fn>
dart:async new Future.sync
package:pub/src/utils.dart 113:12 captureErrors.wrappedCallback
dart:async runZoned
package:pub/src/utils.dart 130:5 captureErrors
package:pub/src/command_runner.dart 176:13 PubCommandRunner.runCommand
This is an unexpected error. Please run
pub --trace publish --dry-run
and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
Another failure w/ publish? Hrm.
I saw https://github.com/dart-lang/pub/issues/2397 and fixed in https://github.com/dart-lang/pub/commit/737f055d0a1cfb348178dbde6bd13f06704bf6d4
but this looks different. And your SDK is after I merged the fix – at least I think.
@munificent – have you done a gclient sync to get the latest pub?
I believe this is fixed at sdk/HEAD with https://github.com/dart-lang/pub/pull/2400 .
I created: https://dart-review.googlesource.com/c/sdk/+/141246 to pull it into the sdk
I meet the same issue, the flutter version is:
Flutter 1.16.3-pre.67 • channel master • https://github.com/flutter/flutter.git
Framework • revision be3a4b37b3 (16 hours ago) • 2020-03-26 18:08:05 -0700
Engine • revision b2bdeb3f0f
Tools • Dart 2.8.0 (build 2.8.0-dev.17.0 1402e8e1a4)
In this version, is there a temporary workaround to publish pub?
@nekocode – switch the the flutter dev/beta/stable channel to publish?
@munificent – have you done a
gclient syncto get the latest pub?
I had yesterday shortly before filing this, yes.
@nekocode
In this version, is there a temporary workaround to publish pub?
Hmm - you should be able to run an older (non-affected) pub version with a stable flutter.
$ flutter channel stable
$ flutter pub publish
If that doesn't work for some reason you could consider
cd tmp
git clone https://github.com/dart-lang/pub
cd project
FLUTTER_ROOT=$HOME/path/to/flutter $HOME/path/to/flutter/bin/cache/dart-sdk/bin/dart tmp/pub/bin/pub.dart publish
I have the same issue using pub from the latest build master:
...
| Nothing output on stderr.
IO : Reading binary file ./CHANGELOG.md.
IO : Read 9248 bytes from ./CHANGELOG.md.
IO : Spawning "/usr/bin/tar --format=ustar --create --gzip --directory /Users/annagrin/source/webdev/dwds/. @/dev/stdin" in /Users/annagrin/source/webdev/dwds/.
ERR : The getter 'major' was called on null.
| Receiver: null
| Tried calling: major
FINE: Exception type: NoSuchMethodError
ERR : dart:core Object.noSuchMethod
| package:analyzer/src/dart/ast/ast.dart 2037:34 CompilationUnitImpl.languageVersion
| package:pub/src/validator/language_version.dart 57:40 LanguageVersionValidator.validate
| package:pub/src/validator.dart 136:64 Validator.runAll.
| dart:async Future.wait
| package:pub/src/validator.dart 136:19 Validator.runAll
| package:pub/src/command/lish.dart 163:32 LishCommand._validate
| package:pub/src/command/lish.dart 143:15 LishCommand.run
| package:args/command_runner.dart 197:27 CommandRunner.runCommand
| package:pub/src/command_runner.dart 176:39 PubCommandRunner.runCommand.
| dart:async new Future.sync
| package:pub/src/utils.dart 113:12 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 126:11 captureErrors
| package:pub/src/command_runner.dart 176:13 PubCommandRunner.runCommand
| ===== asynchronous gap ===========================
| dart:async Future.catchError
| package:pub/src/utils.dart 113:52 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 126:11 captureErrors
| package:pub/src/command_runner.dart 176:13 PubCommandRunner.runCommand
---- End log transcript ----
It should go away when the next dart sdk is rolled into flutter containing #2400 🤞
I had this error as well and just submitted this PR to fix it: https://github.com/dart-lang/build/pull/2671
If you look at the stack traces the errors are not the same, and not even in the same package.
I believe this issue is fixed.
Most helpful comment
@nekocode
Hmm - you should be able to run an older (non-affected) pub version with a stable flutter.
If that doesn't work for some reason you could consider