Dart工作直到我更新编辑器,现在我得到现有和新项目的错误。我尝试完全重新安装Dart。当我在web-ui上为新项目运行pub install时,我收到以下消息:
--- Jun 11, 2013 10:25:11 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
干净安装中该目录中没有“version”文件是正确的。我添加了该文件并收到以下消息:
--- Jun 11, 2013 10:23:42 PM Running pub install ... ---
Pub install failed, [69] Resolving dependencies...
Failed NSS_Init call.
创建新项目时,我得到以下信息:
--- Jun 11, 2013 10:26:17 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/MyApp/build.dart
build.dart returned error code 255
Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/MyApp/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:18 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
--- Jun 11, 2013 10:26:18 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/Test02/build.dart
build.dart returned error code 255
Unable to open file: C:/Users/Phloxicon/Dropbox/dart/Test02/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/Test02/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:18 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/quiz_generator/build.dart
build.dart returned error code 255
Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/quiz_generator/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:19 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/build.dart
build.dart returned error code 255
Unable to open file: C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/sdgdsfg/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:19 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/build.dart
build.dart returned error code 255
Unable to open file: C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/srtgdsfg/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:19 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/test1/build.dart
build.dart returned error code 255
Do not know how to load 'dart:uri''package:analyzer_experimental/src/generated/java_core.dart': Error: line 4 pos 1: library handler failed
import "dart:uri";
^
'package:analyzer_experimental/src/generated/ast.dart': Error: line 7 pos 1: library handler failed
import 'java_core.dart';
^
'package:web_ui/src/compiler.dart': Error: line 10 pos 1: library handler failed
import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
^
'package:web_ui/dwc.dart': Error: line 12 pos 1: library handler failed
import 'src/compiler.dart';
^
'package:web_ui/component_build.dart': Error: line 26 pos 1: library handler failed
import 'dwc.dart' as dwc;
^
'file:///C:/Users/Phloxicon/Dropbox/dart/test1/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:20 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
--- Jun 11, 2013 10:26:20 PM build.dart --machine --full ---
file:/C:/Users/Phloxicon/Dropbox/dart/testest/build.dart
build.dart returned error code 255
Unable to open file: C:/Users/Phloxicon/Dropbox/dart/testest/packages/web_ui/component_build.dart'file:///C:/Users/Phloxicon/Dropbox/dart/testest/build.dart': Error: line 2 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
^
--- Jun 11, 2013 10:26:20 PM Running pub install ... ---
Pub install failed, [255] Unhandled exception:
FileIOException: Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version' (OS Error: The system cannot find the file specified.
, errno = 2)
#0 _File.throwIfError (file_impl.dart:444:7)
#1 _File.openSync (file_impl.dart:310:17)
#2 _File.readAsBytesSync (file_impl.dart:363:26)
#3 _File.readAsStringSync (file_impl.dart:381:41)
#4 readTextFile (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/io.dart:71:68)
#5 _getVersion (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:24:29)
#6 version (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/lib/src/sdk.dart:17:30)
#7 main (file:///e:/b/build/slave/dart-editor-win-trunk/build/dart/sdk/lib/_internal/pub/bin/pub.dart:61:30)
有什么想法吗?
答案 0 :(得分:1)
Cannot open file 'C:\Users\Phloxicon\Documents\dart\dart-sdk\bin\version'
这看起来您的Dart安装已损坏。安装Dart SDK时,该文件肯定应该存在,如果没有它,pub就无法工作。
您是自己构建SDK还是仅下载预构建的SDK?
答案 1 :(得分:0)
尝试pub update
而不是pub install
,以便尽可能更新缓存的包。
然后从同一个“工具”菜单中使用Reanalyze Sources
。确保在运行Reanalyze Sources
之前清除所有日志,这样您就可以确定它是干净的构建。
如果这不能让您彻底清理,请删除您在项目树中看到的所有packages
目录,以及可能会挂起的任何out
目录,以及{{1}文件。然后运行pubspec.lock
。
这通常会让我回到干净的构建中。